Add printable guest sign studio and refine event imagery
This commit is contained in:
@@ -20,7 +20,7 @@ export const bannersRouter = createTRPCRouter({
|
||||
if (!limit.allowed) throw new TRPCError({ code: "TOO_MANY_REQUESTS", message: "Too many banner uploads. Try again shortly." });
|
||||
const id = randomUUID();
|
||||
const originalKey = `events/${input.eventId}/banners/${id}/original`;
|
||||
await getDb().insert(eventBanners).values({ id, eventId: input.eventId, originalKey, contentType: input.contentType, byteSize: input.byteSize });
|
||||
await getDb().insert(eventBanners).values({ id, eventId: input.eventId, originalKey, contentType: input.contentType, byteSize: input.byteSize, crop: input.crop });
|
||||
return { bannerId: id, uploadUrl: await createPresignedPutUrl({ key: originalKey, contentType: input.contentType }) };
|
||||
}),
|
||||
complete: protectedProcedure.input(bannerInputSchema).mutation(async ({ ctx, input }) => {
|
||||
|
||||
@@ -0,0 +1,14 @@
|
||||
import QRCode from "qrcode";
|
||||
|
||||
export function signQr(url: string) {
|
||||
const parsed = new URL(url);
|
||||
if (!["http:", "https:"].includes(parsed.protocol)) throw new Error("Guest link must be HTTP or HTTPS");
|
||||
const { modules } = QRCode.create(url, { errorCorrectionLevel: "M" });
|
||||
let path = "";
|
||||
for (let y = 0; y < modules.size; y++) {
|
||||
for (let x = 0; x < modules.size; x++) {
|
||||
if (modules.get(y, x)) path += `M${x} ${y}h1v1h-1z`;
|
||||
}
|
||||
}
|
||||
return { path, size: modules.size };
|
||||
}
|
||||
Reference in New Issue
Block a user