From 16c016e8b1d5ca46343d3363f9a49e24c5d7c944 Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Wed, 12 May 2021 14:09:04 +0200 Subject: Stricter models typing --- server/lib/activitypub/actor.ts | 3 +-- server/lib/job-queue/handlers/video-views.ts | 4 ++-- server/lib/video-channel.ts | 4 +--- server/lib/video.ts | 2 ++ 4 files changed, 6 insertions(+), 7 deletions(-) (limited to 'server/lib') diff --git a/server/lib/activitypub/actor.ts b/server/lib/activitypub/actor.ts index 8865b6277..1bcee7ef9 100644 --- a/server/lib/activitypub/actor.ts +++ b/server/lib/activitypub/actor.ts @@ -132,12 +132,11 @@ async function getOrCreateActorAndServerAndModel ( return actorRefreshed } -function buildActorInstance (type: ActivityPubActorType, url: string, preferredUsername: string, uuid?: string) { +function buildActorInstance (type: ActivityPubActorType, url: string, preferredUsername: string) { return new ActorModel({ type, url, preferredUsername, - uuid, publicKey: null, privateKey: null, followersCount: 0, diff --git a/server/lib/job-queue/handlers/video-views.ts b/server/lib/job-queue/handlers/video-views.ts index 897235ec0..86d0a271f 100644 --- a/server/lib/job-queue/handlers/video-views.ts +++ b/server/lib/job-queue/handlers/video-views.ts @@ -36,8 +36,8 @@ async function processVideosViews () { } await VideoViewModel.create({ - startDate, - endDate, + startDate: new Date(startDate), + endDate: new Date(endDate), views, videoId }) diff --git a/server/lib/video-channel.ts b/server/lib/video-channel.ts index 0476cb2d5..d57e832fe 100644 --- a/server/lib/video-channel.ts +++ b/server/lib/video-channel.ts @@ -1,5 +1,4 @@ import * as Sequelize from 'sequelize' -import { v4 as uuidv4 } from 'uuid' import { VideoChannelCreate } from '../../shared/models' import { VideoModel } from '../models/video/video' import { VideoChannelModel } from '../models/video/video-channel' @@ -9,9 +8,8 @@ import { getLocalVideoChannelActivityPubUrl } from './activitypub/url' import { federateVideoIfNeeded } from './activitypub/videos' async function createLocalVideoChannel (videoChannelInfo: VideoChannelCreate, account: MAccountId, t: Sequelize.Transaction) { - const uuid = uuidv4() const url = getLocalVideoChannelActivityPubUrl(videoChannelInfo.name) - const actorInstance = buildActorInstance('Group', url, videoChannelInfo.name, uuid) + const actorInstance = buildActorInstance('Group', url, videoChannelInfo.name) const actorInstanceCreated = await actorInstance.save({ transaction: t }) diff --git a/server/lib/video.ts b/server/lib/video.ts index 21e4b7ff2..d26cf85cd 100644 --- a/server/lib/video.ts +++ b/server/lib/video.ts @@ -28,6 +28,8 @@ function buildLocalVideoFromReq (videoInfo: VideoCreate, channelId: number): Fil privacy: videoInfo.privacy || VideoPrivacy.PRIVATE, channelId: channelId, originallyPublishedAt: videoInfo.originallyPublishedAt + ? new Date(videoInfo.originallyPublishedAt) + : null } } -- cgit v1.2.3