From 8c4bbd946d2247c2e239cbbf8773d2d31c1a57aa Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Tue, 10 Jan 2023 11:09:30 +0100 Subject: Refactor model utils --- server/models/abuse/abuse-message.ts | 2 +- server/models/abuse/abuse.ts | 2 +- server/models/abuse/sql/abuse-query-builder.ts | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) (limited to 'server/models/abuse') diff --git a/server/models/abuse/abuse-message.ts b/server/models/abuse/abuse-message.ts index 20008768b..14a5bffa2 100644 --- a/server/models/abuse/abuse-message.ts +++ b/server/models/abuse/abuse-message.ts @@ -5,7 +5,7 @@ import { MAbuseMessage, MAbuseMessageFormattable } from '@server/types/models' import { AbuseMessage } from '@shared/models' import { AttributesOnly } from '@shared/typescript-utils' import { AccountModel, ScopeNames as AccountScopeNames } from '../account/account' -import { getSort, throwIfNotValid } from '../utils' +import { getSort, throwIfNotValid } from '../shared' import { AbuseModel } from './abuse' @Table({ diff --git a/server/models/abuse/abuse.ts b/server/models/abuse/abuse.ts index 5610077c9..4ce40bf2f 100644 --- a/server/models/abuse/abuse.ts +++ b/server/models/abuse/abuse.ts @@ -34,7 +34,7 @@ import { AttributesOnly } from '@shared/typescript-utils' import { ABUSE_STATES, CONSTRAINTS_FIELDS } from '../../initializers/constants' import { MAbuseAdminFormattable, MAbuseAP, MAbuseFull, MAbuseReporter, MAbuseUserFormattable, MUserAccountId } from '../../types/models' import { AccountModel, ScopeNames as AccountScopeNames, SummaryOptions as AccountSummaryOptions } from '../account/account' -import { getSort, throwIfNotValid } from '../utils' +import { getSort, throwIfNotValid } from '../shared' import { ThumbnailModel } from '../video/thumbnail' import { ScopeNames as VideoScopeNames, VideoModel } from '../video/video' import { VideoBlacklistModel } from '../video/video-blacklist' diff --git a/server/models/abuse/sql/abuse-query-builder.ts b/server/models/abuse/sql/abuse-query-builder.ts index 854f0cda8..282d4541a 100644 --- a/server/models/abuse/sql/abuse-query-builder.ts +++ b/server/models/abuse/sql/abuse-query-builder.ts @@ -2,7 +2,7 @@ import { exists } from '@server/helpers/custom-validators/misc' import { forceNumber } from '@shared/core-utils' import { AbuseFilter, AbuseState, AbuseVideoIs } from '@shared/models' -import { buildBlockedAccountSQL, buildDirectionAndField } from '../../utils' +import { buildBlockedAccountSQL, buildSortDirectionAndField } from '../../shared' export type BuildAbusesQueryOptions = { start: number @@ -157,7 +157,7 @@ function buildAbuseListQuery (options: BuildAbusesQueryOptions, type: 'count' | } function buildAbuseOrder (value: string) { - const { direction, field } = buildDirectionAndField(value) + const { direction, field } = buildSortDirectionAndField(value) return `ORDER BY "abuse"."${field}" ${direction}` } -- cgit v1.2.3