type orm scope code example
Example: scope in typeorm
class UserScopes extends SelectQueryBuilder<User> {
get notDeleted(): UserScopes {
return this.andWhere("state != :state", {state: "deleted"});
}
}
@EntityRepository(User)
export class UserRepository extends Repository<User> {
get scoped(): UserScopes {
return new UserScopes(this.createQueryBuilder("user"));
}
}