X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=shared%2Fserver-commands%2Fmiscs%2Fsql-command.ts;h=f163cc8c990e44d5575be934dd623455e236c23e;hb=77239b425a8e00822a53c9907415832a473c3eb6;hp=09a99f8340066bdf2621d26b109ccc7a6b277ecf;hpb=c3edc5b074aa4bb1861ed0a94d3713808e87170f;p=github%2FChocobozzz%2FPeerTube.git diff --git a/shared/server-commands/miscs/sql-command.ts b/shared/server-commands/miscs/sql-command.ts index 09a99f834..f163cc8c9 100644 --- a/shared/server-commands/miscs/sql-command.ts +++ b/shared/server-commands/miscs/sql-command.ts @@ -1,4 +1,5 @@ import { QueryTypes, Sequelize } from 'sequelize' +import { forceNumber } from '@shared/core-utils' import { AbstractCommand } from '../shared' export class SQLCommand extends AbstractCommand { @@ -23,6 +24,11 @@ export class SQLCommand extends AbstractCommand { return parseInt(total, 10) } + async getInternalFileUrl (fileId: number) { + return this.selectQuery(`SELECT "fileUrl" FROM "videoFile" WHERE id = ${fileId}`) + .then(rows => rows[0].fileUrl as string) + } + setActorField (to: string, field: string, value: string) { const seq = this.getSequelize() @@ -58,7 +64,7 @@ export class SQLCommand extends AbstractCommand { if (!total) return 0 - return parseInt(total + '', 10) + return forceNumber(total) } getActorImage (filename: string) {