Implement scopes on models and support interacting with them via ModelBuilder
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
This commit is contained in:
11
src/orm/model/scope/ActiveScope.ts
Normal file
11
src/orm/model/scope/ActiveScope.ts
Normal file
@@ -0,0 +1,11 @@
|
||||
import {Scope} from './Scope'
|
||||
import {AbstractBuilder} from '../../builder/AbstractBuilder'
|
||||
|
||||
/**
|
||||
* A basic scope to limit results where `active` = true.
|
||||
*/
|
||||
export class ActiveScope extends Scope {
|
||||
apply(query: AbstractBuilder<any>): void {
|
||||
query.where('active', '=', true)
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user