X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=server%2Fmodels%2Futils.ts;h=70bfbdb8bfa4748dc770186c7a95b913454df570;hb=4b3145a7f8f5f1e24f9ea7874dee387204e65fcb;hp=6a109056ff964c621d2694edb961c8380e1a126b;hpb=0c691a182c7aeaf0d0e6f7f71d46d6f558e2843b;p=github%2FChocobozzz%2FPeerTube.git diff --git a/server/models/utils.ts b/server/models/utils.ts index 6a109056f..70bfbdb8b 100644 --- a/server/models/utils.ts +++ b/server/models/utils.ts @@ -1,5 +1,4 @@ import { literal, Op, OrderItem, Sequelize } from 'sequelize' -import { Col } from 'sequelize/types/lib/utils' import validator from 'validator' type SortType = { sortModel: string, sortValue: string } @@ -8,7 +7,7 @@ type SortType = { sortModel: string, sortValue: string } function getSort (value: string, lastSort: OrderItem = [ 'id', 'ASC' ]): OrderItem[] { const { direction, field } = buildDirectionAndField(value) - let finalField: string | Col + let finalField: string | ReturnType if (field.toLowerCase() === 'match') { // Search finalField = Sequelize.col('similarity') @@ -65,7 +64,7 @@ function getVideoSort (value: string, lastSort: OrderItem = [ 'id', 'ASC' ]): Or ] } - let finalField: string | Col + let finalField: string | ReturnType // Alias if (field.toLowerCase() === 'match') { // Search @@ -182,7 +181,7 @@ function buildServerIdsFollowedBy (actorId: any) { 'SELECT "actor"."serverId" FROM "actorFollow" ' + 'INNER JOIN "actor" ON actor.id = "actorFollow"."targetActorId" ' + 'WHERE "actorFollow"."actorId" = ' + actorIdNumber + - ')' + ')' } function buildWhereIdOrUUID (id: number | string) { @@ -238,7 +237,8 @@ function searchAttribute (sourceField?: string, targetField?: string) { return { [targetField]: { - [Op.iLike]: `%${sourceField}%` + // FIXME: ts error + [Op.iLike as any]: `%${sourceField}%` } } }