Problems with the Prisma repository pattern?

Is there an issue with the repository pattern I've configured?
/* eslint-disable */
export class CommonRepository<
Delegate extends {
create: (...args: any) => any;
createMany: (...args: any) => any;
createManyAndReturn: (...args: any) => any;
...
},
> {
constructor(protected readonly model: any) {
this.create = model.create.bind(model);
this.createMany = model.createMany.bind(model);
this.createManyAndReturn = model.createManyAndReturn.bind(model);
...
}

public create!: Delegate['create'];
public createMany!: Delegate['createMany'];
public createManyAndReturn!: Delegate['createManyAndReturn'];
...
}
/* eslint-disable */
export class CommonRepository<
Delegate extends {
create: (...args: any) => any;
createMany: (...args: any) => any;
createManyAndReturn: (...args: any) => any;
...
},
> {
constructor(protected readonly model: any) {
this.create = model.create.bind(model);
this.createMany = model.createMany.bind(model);
this.createManyAndReturn = model.createManyAndReturn.bind(model);
...
}

public create!: Delegate['create'];
public createMany!: Delegate['createMany'];
public createManyAndReturn!: Delegate['createManyAndReturn'];
...
}
@Injectable()
export class UserRepository extends CommonRepository<UserDelegate> {
constructor(private prisma: Database) {
super(prisma.user);
}
}
@Injectable()
export class UserRepository extends CommonRepository<UserDelegate> {
constructor(private prisma: Database) {
super(prisma.user);
}
}
3 Replies
Prisma AI Help
Prisma AI Help6mo ago
You selected the carefully hand-crafted route. A dev artisan will respond soon. Meanwhile, the #ask-ai channel awaits if you're curious!
Nurul
Nurul6mo ago
Are you running inyo any any specific issues or are you looking for just feedback?
inhanbyeol
inhanbyeolOP6mo ago
I'd like to get some feedback, I'm wondering if there are any issues with using the repository pattern with this structure

Did you find this page helpful?