Update dependencies & fix misc formatting errors
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
import {Container, Inject, Injectable} from '../../di'
|
||||
import {Inject, Injectable} from '../../di'
|
||||
import {Migrator} from './Migrator'
|
||||
import {DatabaseService} from '../DatabaseService'
|
||||
import {FieldType} from '../types'
|
||||
@@ -14,9 +14,6 @@ export class DatabaseMigrator extends Migrator {
|
||||
@Inject()
|
||||
protected readonly db!: DatabaseService
|
||||
|
||||
@Inject('injector')
|
||||
protected readonly injector!: Container
|
||||
|
||||
/** True if we've initialized the migrator. */
|
||||
protected initialized = false
|
||||
|
||||
|
||||
@@ -1,11 +1,10 @@
|
||||
import {ModelKey, QueryRow, QuerySource} from '../types'
|
||||
import {Container, Inject, Instantiable, isInstantiable} from '../../di'
|
||||
import {Container, Instantiable, isInstantiable} from '../../di'
|
||||
import {DatabaseService} from '../DatabaseService'
|
||||
import {ModelBuilder} from './ModelBuilder'
|
||||
import {getFieldsMeta, ModelField} from './Field'
|
||||
import {deepCopy, Collection, uuid4, isKeyof, Pipeline, hasOwnProperty} from '../../util'
|
||||
import {EscapeValueObject, QuerySafeValue} from '../dialect/SQLDialect'
|
||||
import {Logging} from '../../service/Logging'
|
||||
import {Connection} from '../connection/Connection'
|
||||
import {ModelRetrievedEvent} from './events/ModelRetrievedEvent'
|
||||
import {ModelSavingEvent} from './events/ModelSavingEvent'
|
||||
@@ -26,9 +25,6 @@ import {ModelEvent} from './events/ModelEvent'
|
||||
* Base for classes that are mapped to tables in a database.
|
||||
*/
|
||||
export abstract class Model<T extends Model<T>> extends LocalBus<ModelEvent<T>> {
|
||||
@Inject()
|
||||
protected readonly logging!: Logging
|
||||
|
||||
/**
|
||||
* The name of the connection this model should run through.
|
||||
* @type string
|
||||
|
||||
@@ -8,18 +8,18 @@ import {ModelBuilder} from '../model/ModelBuilder'
|
||||
* A model instance which stores records from the ORMCache driver.
|
||||
*/
|
||||
export class CacheModel extends Model<CacheModel> {
|
||||
protected static table = 'caches'; // FIXME allow configuring
|
||||
protected static table = 'caches' // FIXME allow configuring
|
||||
|
||||
protected static key = 'cache_key';
|
||||
protected static key = 'cache_key'
|
||||
|
||||
@Field(FieldType.varchar, 'cache_key')
|
||||
public cacheKey!: string;
|
||||
public cacheKey!: string
|
||||
|
||||
@Field(FieldType.text, 'cache_value')
|
||||
public cacheValue!: string;
|
||||
public cacheValue!: string
|
||||
|
||||
@Field(FieldType.timestamp, 'cache_expires')
|
||||
public cacheExpires?: Date;
|
||||
public cacheExpires?: Date
|
||||
|
||||
public static withCacheKey(key: string): ModelBuilder<CacheModel> {
|
||||
return this.query<CacheModel>()
|
||||
|
||||
@@ -35,7 +35,7 @@ export class ORMSession extends Session {
|
||||
this.data = this.session.json
|
||||
} else {
|
||||
this.session = <SessionModel> Container.getContainer().make(SessionModel)
|
||||
this.session.uuid = this.key
|
||||
this.session.sessionUuid = this.key
|
||||
this.data = {} as SessionData
|
||||
}
|
||||
}
|
||||
@@ -48,7 +48,7 @@ export class ORMSession extends Session {
|
||||
throw new SessionNotLoadedError()
|
||||
}
|
||||
|
||||
this.session.uuid = this.key
|
||||
this.session.sessionUuid = this.key
|
||||
this.session.json = JSON.stringify(this.data)
|
||||
await this.session.save()
|
||||
}
|
||||
|
||||
@@ -13,8 +13,8 @@ export class SessionModel extends Model<SessionModel> {
|
||||
protected static populateKeyOnInsert = true
|
||||
|
||||
@Field(FieldType.varchar, 'session_uuid')
|
||||
public uuid!: string;
|
||||
public sessionUuid!: string
|
||||
|
||||
@Field(FieldType.json, 'session_data')
|
||||
public json!: any;
|
||||
public json!: any
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user