2026-05-09 18:25:04 +08:00
|
|
|
import { Injectable } from '@nestjs/common';
|
2026-05-17 00:39:46 +08:00
|
|
|
import { PrismaService } from '../../infrastructure/database/prisma.service';
|
2026-05-09 18:25:04 +08:00
|
|
|
|
|
|
|
|
@Injectable()
|
|
|
|
|
export class WaitlistRepository {
|
2026-05-17 00:39:46 +08:00
|
|
|
constructor(private readonly prisma: PrismaService) {}
|
2026-05-09 18:25:04 +08:00
|
|
|
|
2026-05-17 00:39:46 +08:00
|
|
|
async findAll() {
|
|
|
|
|
return this.prisma.waitlistEntry.findMany({ orderBy: { createdAt: 'desc' } });
|
2026-05-09 18:25:04 +08:00
|
|
|
}
|
|
|
|
|
|
2026-05-17 00:39:46 +08:00
|
|
|
async create(data: {
|
|
|
|
|
nickname: string;
|
|
|
|
|
email: string;
|
|
|
|
|
devices?: string[];
|
|
|
|
|
interests?: string[];
|
|
|
|
|
painpoint?: string;
|
|
|
|
|
willingBeta?: boolean;
|
|
|
|
|
}) {
|
|
|
|
|
return this.prisma.waitlistEntry.create({
|
|
|
|
|
data: {
|
|
|
|
|
nickname: data.nickname,
|
|
|
|
|
email: data.email,
|
|
|
|
|
devices: data.devices as any,
|
|
|
|
|
interests: data.interests as any,
|
|
|
|
|
painpoint: data.painpoint ?? '',
|
|
|
|
|
willingBeta: data.willingBeta ?? false,
|
|
|
|
|
},
|
|
|
|
|
});
|
2026-05-09 18:25:04 +08:00
|
|
|
}
|
|
|
|
|
}
|