Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Event: add cover #45

Merged
merged 4 commits into from
Feb 6, 2023
Merged

Event: add cover #45

merged 4 commits into from
Feb 6, 2023

Conversation

hulkoba
Copy link
Contributor

@hulkoba hulkoba commented Jan 31, 2023

Description

  • refactor event.links -> event.eventLinks
  • store cover as an attachment

Type of change

  • Bug fix
  • New feature
  • Documentation Update
  • Increase/Reduce Tests
  • Dev Tool Implementation

Checklist

  • Tests are written
  • The new feature is documented

Screenshots

Related Issues or Pull Requests

closes #34
closes #36

@hulkoba hulkoba added the Event label Jan 31, 2023
// const event = await Event.create(payload)
if (cover) {
event.cover = Attachment.fromFile(cover)
await cover.move(Application.tmpPath('uploads'))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

cover.move funktioniert glaube nicht, so richtig erklären kann ich mir das aber nicht. tmpPath kommt dann '/var/folders/6c/szt79xt57dqfc35m33g6p3380000gp/T/cldn6wa690001jmkf5i7l4qa0'das nicht richtig ist. ich habe das in einer anderen func getestet und da kommt bei Application.tmpPath('uploads')der richtige path.
´Attachment.fromFile(cover)`macht aber schon alles, also das bild wird im tmpPath gespeichert.

@hulkoba hulkoba marked this pull request as ready for review February 6, 2023 10:25
await event.merge(payload).save()

const { cover } = await request.validate(CoverUploadValidator)
event.cover = cover ? Attachment.fromFile(cover) : null
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Eigentlich sollte das nicht nötig sein, wenn im Validator nur nullable steht. Aber Das ist vielleicht noch nicht ganz ausgereift

Comment on lines +246 to +268
// TODO: this does not work
// test('not allowed to override the event creator email', async ({ client, assert }) => {
// await EventFactory.create()
// const allEvents = await client.get('/_api/events')
// const { id, createEmail } = allEvents.body().events[0]

// const userRole = await Role.findByOrFail('name', roles.USER)
// const creator = await UserFactory.merge({
// roleId: userRole.id,
// }).create()

// const requestBody = {
// creator_email: creator.email,
// }
// const response = await client.put(`/_api/events/${id}`).withCsrfToken().json(requestBody)

// assert.isTrue(response.body().success)
// assert.equal(response.body().event.create_email, createEmail)
// })

/*
* DELETE Events
*/
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wenn die Roles ready sind, müssen wir hier noch mehr Tests schreiben

@hulkoba hulkoba changed the title WIP: Event/add cover Event: add cover Feb 6, 2023
fix(event): upload event cover

feat(event): validate cover
@tkdamian tkdamian self-requested a review February 6, 2023 11:34
@hulkoba hulkoba merged commit a52496c into main Feb 6, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

event: cover -> attachment refactor event.links to event.eventLinks
2 participants