From f479685678406a5df864d89615b33d29085ebfc6 Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Tue, 6 Apr 2021 11:35:56 +0200 Subject: Agnostic actor image storage --- shared/models/actors/account.model.ts | 4 ++-- shared/models/actors/actor-image.model.ts | 8 ++++++++ shared/models/actors/actor-image.type.ts | 4 ++++ shared/models/actors/actor.model.ts | 4 ++-- shared/models/actors/index.ts | 2 ++ shared/models/avatars/avatar.model.ts | 8 -------- shared/models/avatars/index.ts | 1 - shared/models/index.ts | 1 - shared/models/videos/channel/video-channel.model.ts | 5 ++--- 9 files changed, 20 insertions(+), 17 deletions(-) create mode 100644 shared/models/actors/actor-image.model.ts create mode 100644 shared/models/actors/actor-image.type.ts delete mode 100644 shared/models/avatars/avatar.model.ts delete mode 100644 shared/models/avatars/index.ts (limited to 'shared') diff --git a/shared/models/actors/account.model.ts b/shared/models/actors/account.model.ts index 2ff4b9f5e..120dec271 100644 --- a/shared/models/actors/account.model.ts +++ b/shared/models/actors/account.model.ts @@ -1,5 +1,5 @@ +import { ActorImage } from './actor-image.model' import { Actor } from './actor.model' -import { Avatar } from '../avatars' export interface Account extends Actor { displayName: string @@ -14,5 +14,5 @@ export interface AccountSummary { displayName: string url: string host: string - avatar?: Avatar + avatar?: ActorImage } diff --git a/shared/models/actors/actor-image.model.ts b/shared/models/actors/actor-image.model.ts new file mode 100644 index 000000000..ad5eab627 --- /dev/null +++ b/shared/models/actors/actor-image.model.ts @@ -0,0 +1,8 @@ +export interface ActorImage { + path: string + + url?: string + + createdAt: Date | string + updatedAt: Date | string +} diff --git a/shared/models/actors/actor-image.type.ts b/shared/models/actors/actor-image.type.ts new file mode 100644 index 000000000..ac8eb6bf2 --- /dev/null +++ b/shared/models/actors/actor-image.type.ts @@ -0,0 +1,4 @@ +export const enum ActorImageType { + AVATAR = 1, + BANNER = 2 +} diff --git a/shared/models/actors/actor.model.ts b/shared/models/actors/actor.model.ts index 1dbf5f638..7d9f35b10 100644 --- a/shared/models/actors/actor.model.ts +++ b/shared/models/actors/actor.model.ts @@ -1,4 +1,4 @@ -import { Avatar } from '../avatars/avatar.model' +import { ActorImage } from './actor-image.model' export interface Actor { id: number @@ -9,5 +9,5 @@ export interface Actor { followersCount: number createdAt: Date | string updatedAt: Date | string - avatar?: Avatar + avatar?: ActorImage } diff --git a/shared/models/actors/index.ts b/shared/models/actors/index.ts index c7a92399d..156f83248 100644 --- a/shared/models/actors/index.ts +++ b/shared/models/actors/index.ts @@ -1,3 +1,5 @@ export * from './account.model' +export * from './actor-image.model' +export * from './actor-image.type' export * from './actor.model' export * from './follow.model' diff --git a/shared/models/avatars/avatar.model.ts b/shared/models/avatars/avatar.model.ts deleted file mode 100644 index f7fa16f49..000000000 --- a/shared/models/avatars/avatar.model.ts +++ /dev/null @@ -1,8 +0,0 @@ -export interface Avatar { - path: string - - url?: string - - createdAt: Date | string - updatedAt: Date | string -} diff --git a/shared/models/avatars/index.ts b/shared/models/avatars/index.ts deleted file mode 100644 index 65e8e0882..000000000 --- a/shared/models/avatars/index.ts +++ /dev/null @@ -1 +0,0 @@ -export * from './avatar.model' diff --git a/shared/models/index.ts b/shared/models/index.ts index f105303f4..dff5fdf0e 100644 --- a/shared/models/index.ts +++ b/shared/models/index.ts @@ -1,6 +1,5 @@ export * from './activitypub' export * from './actors' -export * from './avatars' export * from './moderation' export * from './bulk' export * from './redundancy' diff --git a/shared/models/videos/channel/video-channel.model.ts b/shared/models/videos/channel/video-channel.model.ts index 32829e92a..ae6dea42d 100644 --- a/shared/models/videos/channel/video-channel.model.ts +++ b/shared/models/videos/channel/video-channel.model.ts @@ -1,6 +1,5 @@ import { Actor } from '../../actors/actor.model' -import { Account } from '../../actors/index' -import { Avatar } from '../../avatars' +import { Account, ActorImage } from '../../actors' export type ViewsPerDate = { date: Date @@ -24,5 +23,5 @@ export interface VideoChannelSummary { displayName: string url: string host: string - avatar?: Avatar + avatar?: ActorImage } -- cgit v1.2.3