Add printable guest sign studio and refine event imagery
This commit is contained in:
@@ -173,10 +173,20 @@ export const completePhotoInputSchema = z.object({
|
||||
photoId: z.string().uuid(),
|
||||
});
|
||||
|
||||
export const BANNER_ASPECT_RATIO = 8 / 3;
|
||||
export const bannerCropSchema = z.object({
|
||||
x: z.number().finite().min(0).max(100),
|
||||
y: z.number().finite().min(0).max(100),
|
||||
width: z.number().finite().positive().max(100),
|
||||
height: z.number().finite().positive().max(100),
|
||||
}).refine((crop) => crop.x + crop.width <= 100.001 && crop.y + crop.height <= 100.001, "Crop must fit inside the image");
|
||||
export type BannerCrop = z.infer<typeof bannerCropSchema>;
|
||||
|
||||
export const createBannerInputSchema = z.object({
|
||||
eventId: z.string().uuid(),
|
||||
contentType: allowedImageTypeSchema,
|
||||
byteSize: z.number().int().positive().max(MAX_PHOTO_BYTES),
|
||||
crop: bannerCropSchema.optional(),
|
||||
});
|
||||
export const bannerInputSchema = z.object({
|
||||
eventId: z.string().uuid(),
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
ALTER TABLE event_banners ADD COLUMN crop jsonb;
|
||||
@@ -71,6 +71,13 @@
|
||||
"when": 1788906100000,
|
||||
"tag": "0009_photo_exports",
|
||||
"breakpoints": true
|
||||
},
|
||||
{
|
||||
"idx": 10,
|
||||
"version": "7",
|
||||
"when": 1788996000000,
|
||||
"tag": "0010_banner_crop",
|
||||
"breakpoints": true
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
@@ -216,6 +216,7 @@ export const eventBanners = pgTable("event_banners", {
|
||||
eventId: uuid("event_id").notNull().references(() => events.id, { onDelete: "cascade" }),
|
||||
originalKey: text("original_key").notNull(),
|
||||
displayKey: text("display_key"),
|
||||
crop: jsonb("crop").$type<import("@album/contracts").BannerCrop>(),
|
||||
contentType: text("content_type").notNull(),
|
||||
byteSize: integer("byte_size").notNull(),
|
||||
status: text("status").notNull().default("uploading"),
|
||||
|
||||
@@ -13,7 +13,7 @@ describe("object keys", () => {
|
||||
test("keeps originals and variants under the same photo prefix", () => {
|
||||
const prefix = photoObjectPrefix(eventId, photoId);
|
||||
expect(originalObjectKey(eventId, photoId).startsWith(prefix)).toBe(true);
|
||||
expect(displayObjectKey(eventId, photoId)).toBe(`${prefix}display.jpg`);
|
||||
expect(thumbObjectKey(eventId, photoId)).toBe(`${prefix}thumb.jpg`);
|
||||
expect(displayObjectKey(eventId, photoId)).toBe(`${prefix}display.webp`);
|
||||
expect(thumbObjectKey(eventId, photoId)).toBe(`${prefix}thumb.webp`);
|
||||
});
|
||||
});
|
||||
|
||||
@@ -3,11 +3,11 @@ export function originalObjectKey(eventId: string, photoId: string) {
|
||||
}
|
||||
|
||||
export function displayObjectKey(eventId: string, photoId: string) {
|
||||
return `events/${eventId}/photos/${photoId}/display.jpg`;
|
||||
return `events/${eventId}/photos/${photoId}/display.webp`;
|
||||
}
|
||||
|
||||
export function thumbObjectKey(eventId: string, photoId: string) {
|
||||
return `events/${eventId}/photos/${photoId}/thumb.jpg`;
|
||||
return `events/${eventId}/photos/${photoId}/thumb.webp`;
|
||||
}
|
||||
|
||||
export function photoObjectPrefix(eventId: string, photoId: string) {
|
||||
|
||||
Reference in New Issue
Block a user