Files
calendar/apps/api/v2/test/fixtures/repository/webhooks.repository.fixture.ts
T
MorganandGitHub c059d79a51 feat: api v2 webhooks for users and event-types (#15996)
* 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
2024-08-02 12:18:35 +00:00

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 } });
}
}