-
Notifications
You must be signed in to change notification settings - Fork 0
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
Event: add cover #45
Conversation
// const event = await Event.create(payload) | ||
if (cover) { | ||
event.cover = Attachment.fromFile(cover) | ||
await cover.move(Application.tmpPath('uploads')) |
There was a problem hiding this comment.
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.
d013e85
to
cb868f3
Compare
await event.merge(payload).save() | ||
|
||
const { cover } = await request.validate(CoverUploadValidator) | ||
event.cover = cover ? Attachment.fromFile(cover) : null |
There was a problem hiding this comment.
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
// 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 | ||
*/ |
There was a problem hiding this comment.
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
fix(event): upload event cover feat(event): validate cover
cb868f3
to
ceb3756
Compare
test(event): fix dates
Description
Type of change
Checklist
Screenshots
Related Issues or Pull Requests
closes #34
closes #36