X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=server%2Fmodels%2Futils.ts;h=83b2b8f03cba2ac31607088073e5e449cacbd910;hb=d8a4c83b9f61791c2a2f4d8dd47fccde0e79d096;hp=e27625bc862c8a20504b0e12c0224d9539c598b3;hpb=20213fbd2a366dffc35aa7dddad71323893f8d62;p=github%2FChocobozzz%2FPeerTube.git diff --git a/server/models/utils.ts b/server/models/utils.ts index e27625bc8..83b2b8f03 100644 --- a/server/models/utils.ts +++ b/server/models/utils.ts @@ -102,6 +102,10 @@ function getFollowsSort (value: string, lastSort: OrderItem = [ 'id', 'ASC' ]): } function isOutdated (model: { createdAt: Date, updatedAt: Date }, refreshInterval: number) { + if (!model.createdAt || !model.updatedAt) { + throw new Error('Miss createdAt & updatedAt attribuets to model') + } + const now = Date.now() const createdAtTime = model.createdAt.getTime() const updatedAtTime = model.updatedAt.getTime()