* WIP * services * controllers + outputs * unit tests for repositories * use hard coded enum type * use prisma import * remove redunant input file * fix packagejson * rename to spec files * fix typo in option service file name * move membership call to org membership service * move logic to service > repo * fix membership query * attribute controller e2e spec * add options e2e test * add jest watch for e2e --------- Co-authored-by: Morgan Vernay <morgan@cal.com>
31 lines
1.1 KiB
TypeScript
31 lines
1.1 KiB
TypeScript
import { PrismaReadService } from "@/modules/prisma/prisma-read.service";
|
|
import { PrismaWriteService } from "@/modules/prisma/prisma-write.service";
|
|
import { TestingModule } from "@nestjs/testing";
|
|
import { Prisma, User } from "@prisma/client";
|
|
|
|
export class AttributeRepositoryFixture {
|
|
private prismaReadClient: PrismaReadService["prisma"];
|
|
private prismaWriteClient: PrismaWriteService["prisma"];
|
|
|
|
constructor(private readonly module: TestingModule) {
|
|
this.prismaReadClient = module.get(PrismaReadService).prisma;
|
|
this.prismaWriteClient = module.get(PrismaWriteService).prisma;
|
|
}
|
|
|
|
async create(data: Prisma.AttributeCreateInput) {
|
|
return this.prismaWriteClient.attribute.create({ data });
|
|
}
|
|
|
|
async createOption(data: Prisma.AttributeOptionCreateInput) {
|
|
return this.prismaWriteClient.attributeOption.create({ data });
|
|
}
|
|
|
|
async delete(id: string) {
|
|
return this.prismaWriteClient.attribute.delete({ where: { id } });
|
|
}
|
|
|
|
async deleteOption(id: string) {
|
|
return this.prismaWriteClient.attributeOption.delete({ where: { id } });
|
|
}
|
|
}
|