|
@@ -1,6 +1,6 @@
|
|
|
import { DatabaseManager } from '@dzlzv/hydra-db-utils'
|
|
|
import { Worker, WorkerType } from 'query-node'
|
|
|
-import {logger} from '../src/common'
|
|
|
+import { logger, createPredictableId } from '../src/common'
|
|
|
|
|
|
export interface IBootstrapWorkers {
|
|
|
storage: IBootstrapWorker[]
|
|
@@ -9,6 +9,7 @@ export interface IBootstrapWorkers {
|
|
|
|
|
|
export interface IBootstrapWorker {
|
|
|
id: string
|
|
|
+ created_at: string
|
|
|
}
|
|
|
|
|
|
export async function bootWorkers(db: DatabaseManager, workers: IBootstrapWorkers): Promise<void> {
|
|
@@ -25,9 +26,13 @@ export async function bootWorkersInGroup(db: DatabaseManager, workers: IBootstra
|
|
|
// create new membership
|
|
|
const worker = new Worker({
|
|
|
// main data
|
|
|
+ id: await createPredictableId(db),
|
|
|
workerId: rawWorker.id,
|
|
|
type: workerType,
|
|
|
isActive: true,
|
|
|
+
|
|
|
+ createdAt: new Date(rawWorker.created_at),
|
|
|
+ updatedAt: new Date(rawWorker.created_at),
|
|
|
})
|
|
|
|
|
|
// save worker
|