* feat: webhooks for users * fixup! feat: webhooks for users * feat: webhooks for user event types * feat: webhooks for user event types * fixup! Merge branch 'main' into feat-webhooks-api-v2 * doc * chore: split webhook service * chore: webhook repo only depends on prisma * chore: split webhook outputs * fixup! chore: split webhook outputs * chore: describe payload template * chore: pipe webhook input and output * chore: use partialType for update dtos * chore: improve dto
23 lines
828 B
TypeScript
23 lines
828 B
TypeScript
import { PrismaReadService } from "@/modules/prisma/prisma-read.service";
|
|
import { PrismaWriteService } from "@/modules/prisma/prisma-write.service";
|
|
import { TestingModule } from "@nestjs/testing";
|
|
import { Prisma } from "@prisma/client";
|
|
|
|
export class WebhookRepositoryFixture {
|
|
private primaReadClient: PrismaReadService["prisma"];
|
|
private prismaWriteClient: PrismaWriteService["prisma"];
|
|
|
|
constructor(private readonly module: TestingModule) {
|
|
this.primaReadClient = module.get(PrismaReadService).prisma;
|
|
this.prismaWriteClient = module.get(PrismaWriteService).prisma;
|
|
}
|
|
|
|
async create(data: Prisma.WebhookCreateInput) {
|
|
return this.prismaWriteClient.webhook.create({ data });
|
|
}
|
|
|
|
async delete(webhookId: string) {
|
|
return this.prismaWriteClient.webhook.delete({ where: { id: webhookId } });
|
|
}
|
|
}
|