feat: attributes v2 api (#16461)
* 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 <[email protected]>
This commit is contained in:
1 parent
36e79bf69c
commit
2de33fe1bf
33 files changed
+2554
-4
No files matched your search
@@ -0,0 +1,30 @@
|
||||
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 } });
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user