From ee9e7b61f59a427208386738057c8eff48fba599 Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Fri, 16 Jun 2017 10:36:18 +0200 Subject: Create types for model enums --- server/models/job/job-interface.ts | 6 ++++-- server/models/job/job.ts | 3 ++- 2 files changed, 6 insertions(+), 3 deletions(-) (limited to 'server/models/job') diff --git a/server/models/job/job-interface.ts b/server/models/job/job-interface.ts index ab6678257..31b377367 100644 --- a/server/models/job/job-interface.ts +++ b/server/models/job/job-interface.ts @@ -1,8 +1,10 @@ import * as Sequelize from 'sequelize' +import { JobState } from '../../../shared/models/job.model' + export namespace JobMethods { export type ListWithLimitCallback = (err: Error, jobInstances: JobInstance[]) => void - export type ListWithLimit = (limit: number, state: string, callback: ListWithLimitCallback) => void + export type ListWithLimit = (limit: number, state: JobState, callback: ListWithLimitCallback) => void } export interface JobClass { @@ -10,7 +12,7 @@ export interface JobClass { } export interface JobAttributes { - state: string + state: JobState handlerName: string handlerInputData: object } diff --git a/server/models/job/job.ts b/server/models/job/job.ts index 60a6c551b..38e4e8f30 100644 --- a/server/models/job/job.ts +++ b/server/models/job/job.ts @@ -11,6 +11,7 @@ import { JobMethods } from './job-interface' +import { JobState } from '../../../shared/models/job.model' let Job: Sequelize.Model let listWithLimit: JobMethods.ListWithLimit @@ -48,7 +49,7 @@ export default function defineJob (sequelize: Sequelize.Sequelize, DataTypes: Se // --------------------------------------------------------------------------- -listWithLimit = function (limit: number, state: string, callback: JobMethods.ListWithLimitCallback) { +listWithLimit = function (limit: number, state: JobState, callback: JobMethods.ListWithLimitCallback) { const query = { order: [ [ 'id', 'ASC' ] -- cgit v1.2.3