-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathExampleUserRepo.ts
More file actions
18 lines (16 loc) · 837 Bytes
/
Copy pathExampleUserRepo.ts
File metadata and controls
18 lines (16 loc) · 837 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
import { ConfigurableRepository } from 'lyxe/lib/persistence-typeorm/ConfigurableRepository'
import { SearchConfig } from 'lyxe/lib/persistence/SearchConfig'
import { Repository } from 'lyxe/lib/persistence/annotations/Repository'
import { ExampleUser } from '../domain/model/ExampleUser'
import { IExampleUserRepo } from '../domain/IExampleUserRepo'
import { ExampleUserRepoTkn } from '../domain/example-tokens'
@Repository(ExampleUserRepoTkn)
export class ExampleUserRepo extends ConfigurableRepository<ExampleUser, number> implements IExampleUserRepo {
protected get entityClass() {
return ExampleUser
}
public findByNameQuery(query: string, conf?: SearchConfig): Promise<ExampleUser[]> {
const q = this.queryBuilder().where('name LIKE :pattern', { pattern: query + '%' })
return this.queryEntities(q, conf)
}
}