Productionize EventSphere platform

This commit is contained in:
Austin A
2026-04-25 21:02:19 +01:00
commit 1f1d30a9f5
171 changed files with 18682 additions and 0 deletions

View File

@@ -0,0 +1,52 @@
import { Injectable, NotFoundException } from "@nestjs/common";
import QR from "qrcode";
import { PrismaService } from "../../prisma/prisma.service";
@Injectable()
export class QrcodeService {
constructor(private readonly prisma: PrismaService) {}
findAll(tenantId: string) {
return this.prisma.qRCode.findMany({
where: { tenantId },
orderBy: { createdAt: "desc" },
include: {
registration: { include: { attendee: true, event: true } }
}
});
}
async createForRegistration(tenantId: string, registrationId: string) {
const registration = await this.prisma.registration.findFirst({
where: { id: registrationId, tenantId },
include: { attendee: true, event: true }
});
if (!registration) throw new NotFoundException("Registration not found");
const payload = {
code: registration.code,
eventId: registration.eventId,
tenantId: registration.tenantId,
registrationId: registration.id
};
const qrCode = await this.prisma.qRCode.upsert({
where: { registrationId: registration.id },
create: {
tenantId,
registrationId: registration.id,
code: registration.code,
payload
},
update: {
code: registration.code,
payload,
status: "active"
},
include: { registration: { include: { attendee: true, event: true } } }
});
const dataUrl = await QR.toDataURL(JSON.stringify(payload), { errorCorrectionLevel: "M", margin: 1, width: 320 });
return { qrCode, dataUrl };
}
}