aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/models/account/actor-image.ts
diff options
context:
space:
mode:
Diffstat (limited to 'server/models/account/actor-image.ts')
-rw-r--r--server/models/account/actor-image.ts17
1 files changed, 11 insertions, 6 deletions
diff --git a/server/models/account/actor-image.ts b/server/models/account/actor-image.ts
index f7438991a..ae05b4969 100644
--- a/server/models/account/actor-image.ts
+++ b/server/models/account/actor-image.ts
@@ -1,7 +1,6 @@
1import { remove } from 'fs-extra' 1import { remove } from 'fs-extra'
2import { join } from 'path' 2import { join } from 'path'
3import { AfterDestroy, AllowNull, Column, CreatedAt, Is, Model, Table, UpdatedAt } from 'sequelize-typescript' 3import { AfterDestroy, AllowNull, Column, CreatedAt, Default, Is, Model, Table, UpdatedAt } from 'sequelize-typescript'
4import { v4 as uuidv4 } from 'uuid'
5import { MActorImageFormattable } from '@server/types/models' 4import { MActorImageFormattable } from '@server/types/models'
6import { ActorImageType } from '@shared/models' 5import { ActorImageType } from '@shared/models'
7import { ActorImage } from '../../../shared/models/actors/actor-image.model' 6import { ActorImage } from '../../../shared/models/actors/actor-image.model'
@@ -27,6 +26,16 @@ export class ActorImageModel extends Model {
27 filename: string 26 filename: string
28 27
29 @AllowNull(true) 28 @AllowNull(true)
29 @Default(null)
30 @Column
31 height: number
32
33 @AllowNull(true)
34 @Default(null)
35 @Column
36 width: number
37
38 @AllowNull(true)
30 @Is('ActorImageFileUrl', value => throwIfNotValid(value, isActivityPubUrlValid, 'fileUrl', true)) 39 @Is('ActorImageFileUrl', value => throwIfNotValid(value, isActivityPubUrlValid, 'fileUrl', true))
31 @Column 40 @Column
32 fileUrl: string 41 fileUrl: string
@@ -54,10 +63,6 @@ export class ActorImageModel extends Model {
54 .catch(err => logger.error('Cannot remove actor image file %s.', instance.filename, err)) 63 .catch(err => logger.error('Cannot remove actor image file %s.', instance.filename, err))
55 } 64 }
56 65
57 static generateFilename () {
58 return uuidv4() + '.jpg'
59 }
60
61 static loadByName (filename: string) { 66 static loadByName (filename: string) {
62 const query = { 67 const query = {
63 where: { 68 where: {