feat(TICKET-LOGO): completed feature
This commit is contained in:
@@ -136,12 +136,13 @@ export async function registerPosRoutes(app: FastifyInstance, deps: PosRouteDeps
|
||||
contactPhone: z.string().optional(),
|
||||
receiptHeader: z.string().optional(),
|
||||
receiptFooter: z.string().optional(),
|
||||
logoUrl: z.string().url().max(500).optional(),
|
||||
}),
|
||||
request.body ?? {},
|
||||
);
|
||||
const result = await pool.query<{ id: string; name: string; slug: string; active: boolean }>(
|
||||
`INSERT INTO pos_stores (name, slug, address, tax_id, contact_email, contact_phone, receipt_header, receipt_footer)
|
||||
VALUES ($1, $2, $3, $4, $5, $6, $7, $8)
|
||||
`INSERT INTO pos_stores (name, slug, address, tax_id, contact_email, contact_phone, receipt_header, receipt_footer, logo_url)
|
||||
VALUES ($1, $2, $3, $4, $5, $6, $7, $8, $9)
|
||||
RETURNING id, name, slug, active`,
|
||||
[
|
||||
body.name,
|
||||
@@ -152,6 +153,7 @@ export async function registerPosRoutes(app: FastifyInstance, deps: PosRouteDeps
|
||||
body.contactPhone,
|
||||
body.receiptHeader,
|
||||
body.receiptFooter,
|
||||
body.logoUrl ?? null,
|
||||
],
|
||||
);
|
||||
return reply.code(201).send(result.rows[0]);
|
||||
@@ -1268,6 +1270,7 @@ export async function registerPosRoutes(app: FastifyInstance, deps: PosRouteDeps
|
||||
contactPhone: z.string().trim().max(64).optional(),
|
||||
receiptHeader: z.string().trim().max(500).optional(),
|
||||
receiptFooter: z.string().trim().max(1000).optional(),
|
||||
logoUrl: z.string().url().max(500).optional(),
|
||||
prefix: z
|
||||
.string()
|
||||
.trim()
|
||||
@@ -1288,7 +1291,8 @@ export async function registerPosRoutes(app: FastifyInstance, deps: PosRouteDeps
|
||||
tax_id = COALESCE($4, tax_id), contact_email = COALESCE($5, contact_email),
|
||||
contact_phone = COALESCE($6, contact_phone),
|
||||
receipt_header = COALESCE($7, receipt_header),
|
||||
receipt_footer = COALESCE($8, receipt_footer), updated_at = now()
|
||||
receipt_footer = COALESCE($8, receipt_footer),
|
||||
logo_url = $9, updated_at = now()
|
||||
WHERE id = $1 RETURNING id`,
|
||||
[
|
||||
body.storeId,
|
||||
@@ -1299,6 +1303,7 @@ export async function registerPosRoutes(app: FastifyInstance, deps: PosRouteDeps
|
||||
body.contactPhone,
|
||||
body.receiptHeader,
|
||||
body.receiptFooter,
|
||||
body.logoUrl ?? null,
|
||||
],
|
||||
);
|
||||
if (!store.rows[0]) throw new AppError(404, 'STORE_NOT_FOUND', 'No se encontró la tienda');
|
||||
|
||||
Reference in New Issue
Block a user