From 06215f15e0a9fea2ef95b8b49cb2b5868fb64017 Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Tue, 14 Aug 2018 15:28:30 +0200 Subject: Cleanup utils helper --- server/models/utils.ts | 3 +++ server/models/video/video-blacklist.ts | 6 +++--- 2 files changed, 6 insertions(+), 3 deletions(-) (limited to 'server/models') diff --git a/server/models/utils.ts b/server/models/utils.ts index 58a18c97a..eb6653f3d 100644 --- a/server/models/utils.ts +++ b/server/models/utils.ts @@ -1,6 +1,8 @@ // Translate for example "-name" to [ [ 'name', 'DESC' ], [ 'id', 'ASC' ] ] import { Sequelize } from 'sequelize-typescript' +type SortType = { sortModel: any, sortValue: string } + function getSort (value: string, lastSort: string[] = [ 'id', 'ASC' ]) { let field: any let direction: 'ASC' | 'DESC' @@ -54,6 +56,7 @@ function createSimilarityAttribute (col: string, value: string) { // --------------------------------------------------------------------------- export { + SortType, getSort, getSortOnModel, createSimilarityAttribute, diff --git a/server/models/video/video-blacklist.ts b/server/models/video/video-blacklist.ts index eabc37ef0..67f7cd487 100644 --- a/server/models/video/video-blacklist.ts +++ b/server/models/video/video-blacklist.ts @@ -4,15 +4,15 @@ import { AllowNull, BelongsTo, Column, - CreatedAt, DataType, + CreatedAt, + DataType, ForeignKey, Is, Model, Table, UpdatedAt } from 'sequelize-typescript' -import { SortType } from '../../helpers/utils' -import { getSortOnModel, throwIfNotValid } from '../utils' +import { getSortOnModel, SortType, throwIfNotValid } from '../utils' import { VideoModel } from './video' import { isVideoBlacklistReasonValid } from '../../helpers/custom-validators/video-blacklist' import { Emailer } from '../../lib/emailer' -- cgit v1.2.3