From a6b96f857d949874ba75f657b887a7c997aa7c57 Mon Sep 17 00:00:00 2001 From: Dominik Pschenitschni Date: Thu, 21 Jul 2022 18:35:37 +0200 Subject: [PATCH] feat: extend mode interface from class instead from interface --- src/models/attachment.ts | 3 +-- src/models/avatar.ts | 4 ++-- src/models/backgroundImage.ts | 4 ++-- src/models/bucket.ts | 4 ++-- src/models/caldavToken.ts | 4 ++-- src/models/emailUpdate.ts | 2 +- src/models/file.ts | 2 +- src/models/label.ts | 2 +- src/models/labelTask.ts | 2 +- src/models/linkShare.ts | 4 ++-- src/models/list.ts | 4 ++-- src/models/listDuplicateModel.ts | 2 +- src/models/namespace.ts | 4 ++-- src/models/notification.ts | 2 +- src/models/passwordReset.ts | 2 +- src/models/passwordUpdate.ts | 2 +- src/models/savedFilter.ts | 2 +- src/models/subscription.ts | 2 +- src/models/task.ts | 2 +- src/models/taskAssignee.ts | 2 +- src/models/taskComment.ts | 2 +- src/models/taskRelation.ts | 2 +- src/models/team.ts | 2 +- src/models/teamList.ts | 2 +- src/models/teamMember.ts | 2 +- src/models/teamNamespace.ts | 2 +- src/models/teamShareBase.ts | 2 +- src/models/totp.ts | 2 +- src/models/user.ts | 2 +- src/models/userList.ts | 2 +- src/models/userNamespace.ts | 2 +- src/models/userSettings.ts | 2 +- src/models/userShareBase.ts | 2 +- 33 files changed, 40 insertions(+), 41 deletions(-) diff --git a/src/models/attachment.ts b/src/models/attachment.ts index d2765c4a6..c5c9933c3 100644 --- a/src/models/attachment.ts +++ b/src/models/attachment.ts @@ -1,9 +1,8 @@ import AbstractModel from './abstractModel' import UserModel, {type IUser} from './user' import FileModel, {type IFile} from './file' -import type {IAbstract} from './abstractModel' -export interface IAttachment extends IAbstract { +export interface IAttachment extends AbstractModel { id: number taskId: number createdBy: IUser diff --git a/src/models/avatar.ts b/src/models/avatar.ts index e6a670912..411e3cd3e 100644 --- a/src/models/avatar.ts +++ b/src/models/avatar.ts @@ -1,8 +1,8 @@ -import AbstractModel, { type IAbstract } from './abstractModel' +import AbstractModel from './abstractModel' export type AvatarProvider = 'default' | 'initials' | 'gravatar' | 'marble' | 'upload' -export interface IAvatar extends IAbstract { +export interface IAvatar extends AbstractModel { avatarProvider: AvatarProvider } diff --git a/src/models/backgroundImage.ts b/src/models/backgroundImage.ts index a5dbf8d76..21be0773e 100644 --- a/src/models/backgroundImage.ts +++ b/src/models/backgroundImage.ts @@ -1,6 +1,6 @@ -import AbstractModel, { type IAbstract } from './abstractModel' +import AbstractModel from './abstractModel' -export interface IBackgroundImage extends IAbstract { +export interface IBackgroundImage extends AbstractModel { id: number url: string thumb: string diff --git a/src/models/bucket.ts b/src/models/bucket.ts index 89bca3e91..f4b437594 100644 --- a/src/models/bucket.ts +++ b/src/models/bucket.ts @@ -1,8 +1,8 @@ -import AbstractModel, { type IAbstract } from './abstractModel' +import AbstractModel from './abstractModel' import UserModel, { type IUser } from './user' import TaskModel, { type ITask } from './task' -export interface IBucket extends IAbstract { +export interface IBucket extends AbstractModel { id: number title: string listId: number diff --git a/src/models/caldavToken.ts b/src/models/caldavToken.ts index 5604eb42e..b2186b0a4 100644 --- a/src/models/caldavToken.ts +++ b/src/models/caldavToken.ts @@ -1,6 +1,6 @@ -import AbstractModel, { type IAbstract } from './abstractModel' +import AbstractModel from './abstractModel' -export interface ICaldavToken extends IAbstract { +export interface ICaldavToken extends AbstractModel { id: number; created: Date; } diff --git a/src/models/emailUpdate.ts b/src/models/emailUpdate.ts index 2258176ef..4f6f4385c 100644 --- a/src/models/emailUpdate.ts +++ b/src/models/emailUpdate.ts @@ -1,6 +1,6 @@ import AbstractModel from './abstractModel' -interface IEmailUpdate { +interface IEmailUpdate extends AbstractModel { newEmail: string password: string } diff --git a/src/models/file.ts b/src/models/file.ts index c6248bafd..81240a792 100644 --- a/src/models/file.ts +++ b/src/models/file.ts @@ -1,6 +1,6 @@ import AbstractModel from './abstractModel' -export interface IFile { +export interface IFile extends AbstractModel { id: number mime: string name: string diff --git a/src/models/label.ts b/src/models/label.ts index a4dd72701..75a104e30 100644 --- a/src/models/label.ts +++ b/src/models/label.ts @@ -4,7 +4,7 @@ import {colorIsDark} from '@/helpers/color/colorIsDark' const DEFAULT_LABEL_BACKGROUND_COLOR = 'e8e8e8' -export interface ILabel { +export interface ILabel extends AbstractModel { id: number title: string hexColor: string diff --git a/src/models/labelTask.ts b/src/models/labelTask.ts index 80dee9ded..2179f9a8c 100644 --- a/src/models/labelTask.ts +++ b/src/models/labelTask.ts @@ -1,6 +1,6 @@ import AbstractModel from './abstractModel' -interface ILabel { +interface ILabel extends AbstractModel { id: number taskId: number labelId: number diff --git a/src/models/linkShare.ts b/src/models/linkShare.ts index 1b1ae8804..10100ee42 100644 --- a/src/models/linkShare.ts +++ b/src/models/linkShare.ts @@ -1,8 +1,8 @@ -import AbstractModel, { type IAbstract } from './abstractModel' +import AbstractModel from './abstractModel' import UserModel, { type IUser } from './user' import {RIGHTS, type Right} from '@/models/constants/rights' -export interface ILinkShare extends IAbstract { +export interface ILinkShare extends AbstractModel { id: number hash: string right: Right diff --git a/src/models/list.ts b/src/models/list.ts index a3426f840..7ced89296 100644 --- a/src/models/list.ts +++ b/src/models/list.ts @@ -1,4 +1,4 @@ -import AbstractModel, { type IAbstract } from '@/models/abstractModel' +import AbstractModel from '@/models/abstractModel' import TaskModel, { type ITask } from '@/models/task' import UserModel, { type IUser } from '@/models/user' import SubscriptionModel, { type ISubscription } from '@/models/subscription' @@ -6,7 +6,7 @@ import type { INamespace } from '@/models/namespace' import {getSavedFilterIdFromListId} from '@/helpers/savedFilter' -export interface IList extends IAbstract { +export interface IList extends AbstractModel { id: number title: string description: string diff --git a/src/models/listDuplicateModel.ts b/src/models/listDuplicateModel.ts index bc3272ce2..408965372 100644 --- a/src/models/listDuplicateModel.ts +++ b/src/models/listDuplicateModel.ts @@ -2,7 +2,7 @@ import AbstractModel from './abstractModel' import ListModel, { type IList } from './list' import type { INamespace } from './namespace' -export interface ListDuplicate { +export interface ListDuplicate extends AbstractModel { listId: number namespaceId: INamespace['id'] list: IList diff --git a/src/models/namespace.ts b/src/models/namespace.ts index ee120a962..5d8c608c6 100644 --- a/src/models/namespace.ts +++ b/src/models/namespace.ts @@ -1,9 +1,9 @@ -import AbstractModel, { type IAbstract } from './abstractModel' +import AbstractModel from './abstractModel' import ListModel, { type IList } from './list' import UserModel, { type IUser } from './user' import SubscriptionModel, { type ISubscription } from '@/models/subscription' -export interface INamespace extends IAbstract { +export interface INamespace extends AbstractModel { id: number title: string description: string diff --git a/src/models/notification.ts b/src/models/notification.ts index a21563205..4d9f48ab2 100644 --- a/src/models/notification.ts +++ b/src/models/notification.ts @@ -40,7 +40,7 @@ interface NotificationMemberAdded extends Notification { team: ITeam } -export interface INotification { +export interface INotification extends AbstractModel { id: number name: string notification: NotificationTask | NotificationAssigned | NotificationDeleted | NotificationCreated | NotificationMemberAdded diff --git a/src/models/passwordReset.ts b/src/models/passwordReset.ts index 0dc8ebed0..dd05f37a7 100644 --- a/src/models/passwordReset.ts +++ b/src/models/passwordReset.ts @@ -1,6 +1,6 @@ import AbstractModel from './abstractModel' -export interface IPasswordReset { +export interface IPasswordReset extends AbstractModel { token: string newPassword: string email: string diff --git a/src/models/passwordUpdate.ts b/src/models/passwordUpdate.ts index a91a59c13..51640e323 100644 --- a/src/models/passwordUpdate.ts +++ b/src/models/passwordUpdate.ts @@ -1,6 +1,6 @@ import AbstractModel from '@/models/abstractModel' -export interface IPasswordUpdate { +export interface IPasswordUpdate extends AbstractModel { newPassword: string oldPassword: string } diff --git a/src/models/savedFilter.ts b/src/models/savedFilter.ts index 60c0521cf..168613067 100644 --- a/src/models/savedFilter.ts +++ b/src/models/savedFilter.ts @@ -1,7 +1,7 @@ import AbstractModel from '@/models/abstractModel' import UserModel, { type IUser } from '@/models/user' -export interface ISavedFilter { +export interface ISavedFilter extends AbstractModel { id: 0 title: string description: string diff --git a/src/models/subscription.ts b/src/models/subscription.ts index 013aef7d8..bd52d0d6d 100644 --- a/src/models/subscription.ts +++ b/src/models/subscription.ts @@ -1,7 +1,7 @@ import AbstractModel from '@/models/abstractModel' import UserModel, { type IUser } from '@/models/user' -export interface ISubscription { +export interface ISubscription extends AbstractModel { id: number entity: string // FIXME: correct type? entityId: number // FIXME: correct type? diff --git a/src/models/task.ts b/src/models/task.ts index 518c53a2f..92003d6da 100644 --- a/src/models/task.ts +++ b/src/models/task.ts @@ -26,7 +26,7 @@ export interface RepeatAfter { amount: number } -export interface ITask { +export interface ITask extends AbstractModel { id: number title: string description: string diff --git a/src/models/taskAssignee.ts b/src/models/taskAssignee.ts index 800e50afb..5ceb15ad8 100644 --- a/src/models/taskAssignee.ts +++ b/src/models/taskAssignee.ts @@ -2,7 +2,7 @@ import AbstractModel from './abstractModel' import type { ITask } from './task' import type { IUser } from './user' -export interface ITaskAssignee { +export interface ITaskAssignee extends AbstractModel { created: Date userId: IUser['id'] taskId: ITask['id'] diff --git a/src/models/taskComment.ts b/src/models/taskComment.ts index 93d58958a..15ca3b6d3 100644 --- a/src/models/taskComment.ts +++ b/src/models/taskComment.ts @@ -2,7 +2,7 @@ import AbstractModel from './abstractModel' import UserModel, { type IUser } from './user' import type { ITask } from './task' -export interface ITaskComment { +export interface ITaskComment extends AbstractModel { id: number taskId: ITask['id'] comment: string diff --git a/src/models/taskRelation.ts b/src/models/taskRelation.ts index 2f3b54cbc..e86e9dab0 100644 --- a/src/models/taskRelation.ts +++ b/src/models/taskRelation.ts @@ -19,7 +19,7 @@ export const RELATION_KINDS = [...Object.values(RELATION_KIND)] as const export type RelationKind = typeof RELATION_KINDS[number] -export interface ITaskRelationModel { +export interface ITaskRelationModel extends AbstractModel { id: number otherTaskId: ITask['id'] taskId: ITask['id'] diff --git a/src/models/team.ts b/src/models/team.ts index e76fa216f..b81c99d8e 100644 --- a/src/models/team.ts +++ b/src/models/team.ts @@ -3,7 +3,7 @@ import UserModel, { type IUser } from './user' import TeamMemberModel, { type ITeamMember } from './teamMember' import {RIGHTS, type Right} from '@/models/constants/rights' -export interface ITeam { +export interface ITeam extends AbstractModel { id: number name: string description: string diff --git a/src/models/teamList.ts b/src/models/teamList.ts index 0dce79b60..d3bbb42ab 100644 --- a/src/models/teamList.ts +++ b/src/models/teamList.ts @@ -1,7 +1,7 @@ import TeamShareBaseModel from './teamShareBase' import type { IList } from './list' -export interface ITeamList { +export interface ITeamList extends TeamShareBaseModel { listId: IList['id'] } diff --git a/src/models/teamMember.ts b/src/models/teamMember.ts index ee6eb1619..f699408ad 100644 --- a/src/models/teamMember.ts +++ b/src/models/teamMember.ts @@ -1,7 +1,7 @@ import UserModel from './user' import type { IList } from './list' -export interface ITeamMember { +export interface ITeamMember extends UserModel { admin: boolean teamId: IList['id'] } diff --git a/src/models/teamNamespace.ts b/src/models/teamNamespace.ts index a550bbeea..2064d1412 100644 --- a/src/models/teamNamespace.ts +++ b/src/models/teamNamespace.ts @@ -1,7 +1,7 @@ import TeamShareBaseModel from './teamShareBase' import type { INamespace } from './namespace' -export interface ITeamNamespace { +export interface ITeamNamespace extends TeamShareBaseModel { namespaceId: INamespace['id'] } diff --git a/src/models/teamShareBase.ts b/src/models/teamShareBase.ts index 3983905c7..c3e943701 100644 --- a/src/models/teamShareBase.ts +++ b/src/models/teamShareBase.ts @@ -2,7 +2,7 @@ import AbstractModel from './abstractModel' import {RIGHTS, type Right} from '@/models/constants/rights' import type { ITeam } from './team' -export interface ITeamShareBase { +export interface ITeamShareBase extends AbstractModel { teamId: ITeam['id'] right: Right diff --git a/src/models/totp.ts b/src/models/totp.ts index ab6415987..a47044c5e 100644 --- a/src/models/totp.ts +++ b/src/models/totp.ts @@ -1,6 +1,6 @@ import AbstractModel from './abstractModel' -export interface ITotp { +export interface ITotp extends AbstractModel { secret: string enabled: boolean url: string diff --git a/src/models/user.ts b/src/models/user.ts index f3908149e..eaa472a75 100644 --- a/src/models/user.ts +++ b/src/models/user.ts @@ -1,7 +1,7 @@ import AbstractModel from './abstractModel' import UserSettingsModel, { type IUserSettings } from '@/models/userSettings' -export interface IUser { +export interface IUser extends AbstractModel { id: number email: string username: string diff --git a/src/models/userList.ts b/src/models/userList.ts index 1bc597adf..d0b9cbd36 100644 --- a/src/models/userList.ts +++ b/src/models/userList.ts @@ -1,7 +1,7 @@ import UserShareBaseModel from './userShareBase' import type { IList } from './list' -export interface IUserList { +export interface IUserList extends UserShareBaseModel { listId: IList['id'] } diff --git a/src/models/userNamespace.ts b/src/models/userNamespace.ts index a21995d1a..2a11a35e7 100644 --- a/src/models/userNamespace.ts +++ b/src/models/userNamespace.ts @@ -1,7 +1,7 @@ import UserShareBaseModel from './userShareBase' import type { INamespace } from './namespace' -export interface IUserNamespace { +export interface IUserNamespace extends UserShareBaseModel { namespaceId: INamespace['id'] } diff --git a/src/models/userSettings.ts b/src/models/userSettings.ts index 4e7fcedec..a5db3f807 100644 --- a/src/models/userSettings.ts +++ b/src/models/userSettings.ts @@ -2,7 +2,7 @@ import AbstractModel from './abstractModel' import type { IList } from './list' -export interface IUserSettings { +export interface IUserSettings extends AbstractModel { name: string emailRemindersEnabled: boolean discoverableByName: boolean diff --git a/src/models/userShareBase.ts b/src/models/userShareBase.ts index fadeb894f..8eda9ed29 100644 --- a/src/models/userShareBase.ts +++ b/src/models/userShareBase.ts @@ -2,7 +2,7 @@ import AbstractModel from './abstractModel' import {RIGHTS, type Right} from '@/models/constants/rights' import type { IUser } from './user' -export interface IUserShareBase { +export interface IUserShareBase extends AbstractModel { userId: IUser['id'] right: Right