Start routing and pipeline rewrite
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:
@@ -3,7 +3,7 @@ import {Container, Inject, Instantiable, isInstantiable, StaticClass} from '../.
|
||||
import {DatabaseService} from '../DatabaseService'
|
||||
import {ModelBuilder} from './ModelBuilder'
|
||||
import {getFieldsMeta, ModelField} from './Field'
|
||||
import {deepCopy, Pipe, Collection, Awaitable, uuid4, isKeyof} from '../../util'
|
||||
import {deepCopy, Collection, Awaitable, uuid4, isKeyof, Pipeline} from '../../util'
|
||||
import {EscapeValueObject} from '../dialect/SQLDialect'
|
||||
import {AppClass} from '../../lifecycle/AppClass'
|
||||
import {Logging} from '../../service/Logging'
|
||||
@@ -828,8 +828,8 @@ export abstract class Model<T extends Model<T>> extends AppClass implements Bus
|
||||
/**
|
||||
* Creates a new Pipe instance containing this model instance.
|
||||
*/
|
||||
public pipe(): Pipe<this> {
|
||||
return Pipe.wrap(this)
|
||||
public pipe<TOut>(pipeline: Pipeline<this, TOut>): TOut {
|
||||
return pipeline.apply(this)
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -867,12 +867,11 @@ export abstract class Model<T extends Model<T>> extends AppClass implements Bus
|
||||
|
||||
this.logging.debug(`buildInsertFieldObject populateKeyOnInsert? ${ctor.populateKeyOnInsert}; keyName: ${this.keyName()}`)
|
||||
|
||||
return getFieldsMeta(this)
|
||||
.pipe()
|
||||
return Pipeline.id<Collection<ModelField>>()
|
||||
.unless(ctor.populateKeyOnInsert, fields => {
|
||||
return fields.where('databaseKey', '!=', this.keyName())
|
||||
})
|
||||
.get()
|
||||
.apply(getFieldsMeta(this))
|
||||
.keyMap('databaseKey', inst => (this as any)[inst.modelKey])
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user