feat: restaurant cover photo upload

restaurants.cover_url existed in the schema and was already read by the
public menu page, but nothing could ever write it — the update endpoint
didn't accept it and there was no picker in the app. Adds coverUrl to
PATCH /restaurants/:id and a cover photo picker in the mobile account
screen, next to the existing logo picker.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
AyrisAI
2026-08-29 01:58:10 +03:00
co-authored by Claude Sonnet 5
parent df250c40e8
commit d33a38de4e
2 changed files with 77 additions and 1 deletions
+3 -1
View File
@@ -16,6 +16,7 @@ const createRestaurantSchema = z.object({
const updateRestaurantSchema = z.object({
name: z.string().min(1).max(120).optional(),
logoUrl: z.string().nullish(),
coverUrl: z.string().nullish(),
phone: z.string().max(30).nullish(),
address: z.string().max(500).nullish(),
slug: z.string().min(2).max(100).optional(),
@@ -108,7 +109,7 @@ export const restaurantsRoutes: FastifyPluginAsync = async (app) => {
return reply.code(400).send({ message: "invalid body", issues: parsed.error.issues });
}
const { name, logoUrl, phone, address, slug } = parsed.data;
const { name, logoUrl, coverUrl, phone, address, slug } = parsed.data;
let formattedSlug: string | undefined = undefined;
if (slug !== undefined) {
@@ -145,6 +146,7 @@ export const restaurantsRoutes: FastifyPluginAsync = async (app) => {
.update({
...(name !== undefined ? { name } : {}),
...(logoUrl !== undefined ? { logo_url: logoUrl } : {}),
...(coverUrl !== undefined ? { cover_url: coverUrl } : {}),
...(phone !== undefined ? { phone } : {}),
...(address !== undefined ? { address } : {}),
...(formattedSlug !== undefined ? { slug: formattedSlug } : {}),