Skip to content
This repository has been archived by the owner on Sep 7, 2023. It is now read-only.

Commit

Permalink
🐛 Allow multiple files to be uploaded as well as none
Browse files Browse the repository at this point in the history
  • Loading branch information
matthiasrohmer committed Sep 17, 2021
1 parent 251c0a0 commit d3f769c
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 24 deletions.
20 changes: 12 additions & 8 deletions app/Validators/v1/LocationValidator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,12 @@ export class CreateLocationValidator {
.optional([rules.maxLength(3)])
.members(schema.string({}, [rules.url()])),
}),
media: schema.file({
size: '10mb',
extnames: ['jpg', 'gif', 'png', 'webp'],
}),
media: schema.array.optional().members(
schema.file.optional({
size: '10mb',
extnames: ['jpg', 'gif', 'png', 'webp'],
})
),
});

public cacheKey = this.context.routeKey;
Expand Down Expand Up @@ -55,10 +57,12 @@ export class UpdateLocationValidator {
.optional([rules.maxLength(3)])
.members(schema.string({}, [rules.url()])),
}),
media: schema.file({
size: '10mb',
extnames: ['jpg', 'gif', 'png', 'webp'],
}),
media: schema.array.optional().members(
schema.file.optional({
size: '10mb',
extnames: ['jpg', 'gif', 'png', 'webp'],
})
),
});

public cacheKey = this.context.routeKey;
Expand Down
20 changes: 12 additions & 8 deletions app/Validators/v1/OfferValidator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,12 @@ export class CreateOfferValidator {
.optional([rules.maxLength(3)])
.members(schema.string({}, [rules.url()])),
}),
media: schema.file({
size: '10mb',
extnames: ['jpg', 'gif', 'png', 'webp'],
}),
media: schema.array.optional().members(
schema.file.optional({
size: '10mb',
extnames: ['jpg', 'gif', 'png', 'webp'],
})
),
});

public cacheKey = this.context.routeKey;
Expand Down Expand Up @@ -57,10 +59,12 @@ export class UpdateOfferValidator {
.optional([rules.maxLength(3)])
.members(schema.string({}, [rules.url()])),
}),
media: schema.file({
size: '10mb',
extnames: ['jpg', 'gif', 'png', 'webp'],
}),
media: schema.array.optional().members(
schema.file.optional({
size: '10mb',
extnames: ['jpg', 'gif', 'png', 'webp'],
})
),
});

public cacheKey = this.context.routeKey;
Expand Down
20 changes: 12 additions & 8 deletions app/Validators/v1/OrganizerValidator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,10 +47,12 @@ export class CreateOrganizerValidator {
.optional([rules.maxLength(3)])
.members(schema.string({}, [rules.url()])),
}),
media: schema.file({
size: '10mb',
extnames: ['jpg', 'gif', 'png', 'webp'],
}),
media: schema.array.optional().members(
schema.file.optional({
size: '10mb',
extnames: ['jpg', 'gif', 'png', 'webp'],
})
),
});

public cacheKey = this.context.routeKey;
Expand Down Expand Up @@ -97,10 +99,12 @@ export class UpdateOrganizerValidator {
.optional([rules.maxLength(3)])
.members(schema.string({}, [rules.url()])),
}),
media: schema.file({
size: '10mb',
extnames: ['jpg', 'gif', 'png', 'webp'],
}),
media: schema.array.optional().members(
schema.file.optional({
size: '10mb',
extnames: ['jpg', 'gif', 'png', 'webp'],
})
),
});

public cacheKey = this.context.routeKey;
Expand Down

0 comments on commit d3f769c

Please sign in to comment.