Answers for "scope in typeorm"

0

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"));
  }
}
Posted by: Guest on November-26-2020

Browse Popular Code Answers by Language