fix: use correct model for generics

This commit is contained in:
Dominik Pschenitschni 2022-07-21 18:56:31 +02:00
parent 244478400a
commit 3ba423ed23
No known key found for this signature in database
GPG key ID: B257AC0149F43A77
23 changed files with 47 additions and 44 deletions

View file

@ -1,12 +1,12 @@
import AbstractModel from './abstractModel' import AbstractModel from './abstractModel'
interface ILabel extends AbstractModel { export interface ILabelTask extends AbstractModel {
id: number id: number
taskId: number taskId: number
labelId: number labelId: number
} }
export default class LabelTask extends AbstractModel implements ILabel { export default class LabelTask extends AbstractModel implements ILabelTask {
declare id: number declare id: number
declare taskId: number declare taskId: number
declare labelId: number declare labelId: number

View file

@ -2,13 +2,13 @@ import AbstractModel from './abstractModel'
import ListModel, { type IList } from './list' import ListModel, { type IList } from './list'
import type { INamespace } from './namespace' import type { INamespace } from './namespace'
export interface ListDuplicate extends AbstractModel { export interface IListDuplicate extends AbstractModel {
listId: number listId: number
namespaceId: INamespace['id'] namespaceId: INamespace['id']
list: IList list: IList
} }
export default class ListDuplicateModel extends AbstractModel implements ListDuplicate { export default class ListDuplicateModel extends AbstractModel implements IListDuplicate {
declare listId: number declare listId: number
declare namespaceId: INamespace['id'] declare namespaceId: INamespace['id']
list: IList list: IList

View file

@ -19,7 +19,7 @@ export const RELATION_KINDS = [...Object.values(RELATION_KIND)] as const
export type RelationKind = typeof RELATION_KINDS[number] export type RelationKind = typeof RELATION_KINDS[number]
export interface ITaskRelationModel extends AbstractModel { export interface ITaskRelation extends AbstractModel {
id: number id: number
otherTaskId: ITask['id'] otherTaskId: ITask['id']
taskId: ITask['id'] taskId: ITask['id']
@ -29,7 +29,7 @@ export interface ITaskRelationModel extends AbstractModel {
created: Date created: Date
} }
export default class TaskRelationModel extends AbstractModel implements ITaskRelationModel { export default class TaskRelationModel extends AbstractModel implements ITaskRelation {
declare id: number declare id: number
declare otherTaskId: ITask['id'] declare otherTaskId: ITask['id']
declare taskId: ITask['id'] declare taskId: ITask['id']

View file

@ -1,7 +1,7 @@
import AbstractService from './abstractService' import AbstractService from './abstractService'
import LabelTask from '../models/labelTask' import LabelTask, {type ILabelTask} from '@/models/labelTask'
export default class LabelTaskService extends AbstractService { export default class LabelTaskService extends AbstractService<ILabelTask> {
constructor() { constructor() {
super({ super({
create: '/tasks/{taskId}/labels', create: '/tasks/{taskId}/labels',

View file

@ -1,8 +1,8 @@
import AbstractService from './abstractService' import AbstractService from './abstractService'
import LinkShareModel from '../models/linkShare' import LinkShareModel, { type ILinkShare } from '@/models/linkShare'
import {formatISO} from 'date-fns' import {formatISO} from 'date-fns'
export default class ListService extends AbstractService { export default class LinkShareService extends AbstractService<ILinkShare> {
constructor() { constructor() {
super({ super({
getAll: '/lists/{listId}/shares', getAll: '/lists/{listId}/shares',

View file

@ -1,7 +1,7 @@
import AbstractService from './abstractService' import AbstractService from './abstractService'
import listDuplicateModel from '../models/listDuplicateModel' import listDuplicateModel, {type IListDuplicate} from '../models/listDuplicateModel'
export default class ListDuplicateService extends AbstractService { export default class ListDuplicateService extends AbstractService<IListDuplicate> {
constructor() { constructor() {
super({ super({
create: '/lists/{listId}/duplicate', create: '/lists/{listId}/duplicate',

View file

@ -1,8 +1,8 @@
import AbstractService from '@/services/abstractService' import AbstractService from '@/services/abstractService'
import {formatISO} from 'date-fns' import {formatISO} from 'date-fns'
import NotificationModel from '@/models/notification' import NotificationModel, { type INotification } from '@/models/notification'
export default class NotificationService extends AbstractService { export default class NotificationService extends AbstractService<INotification> {
constructor() { constructor() {
super({ super({
getAll: '/notifications', getAll: '/notifications',

View file

@ -1,7 +1,7 @@
import AbstractService from './abstractService' import AbstractService from './abstractService'
import PasswordResetModel from '../models/passwordReset' import PasswordResetModel, { type IPasswordReset } from '../models/passwordReset'
export default class PasswordResetService extends AbstractService { export default class PasswordResetService extends AbstractService<IPasswordReset> {
constructor() { constructor() {
super({}) super({})

View file

@ -1,6 +1,7 @@
import type { IPasswordUpdate } from '@/models/passwordUpdate'
import AbstractService from './abstractService' import AbstractService from './abstractService'
export default class PasswordUpdateService extends AbstractService { export default class PasswordUpdateService extends AbstractService<IPasswordUpdate> {
constructor() { constructor() {
super({ super({
update: '/user/password', update: '/user/password',

View file

@ -1,8 +1,8 @@
import AbstractService from '@/services/abstractService' import AbstractService from '@/services/abstractService'
import SavedFilterModel from '@/models/savedFilter' import SavedFilterModel, { type ISavedFilter } from '@/models/savedFilter'
import {objectToCamelCase} from '@/helpers/case' import {objectToCamelCase} from '@/helpers/case'
export default class SavedFilterService extends AbstractService { export default class SavedFilterService extends AbstractService<ISavedFilter> {
constructor() { constructor() {
super({ super({
get: '/filters/{id}', get: '/filters/{id}',

View file

@ -1,7 +1,7 @@
import AbstractService from '@/services/abstractService' import AbstractService from '@/services/abstractService'
import SubscriptionModel from '@/models/subscription' import SubscriptionModel, { type ISubscription } from '@/models/subscription'
export default class SubscriptionService extends AbstractService { export default class SubscriptionService extends AbstractService<ISubscription> {
constructor() { constructor() {
super({ super({
create: '/subscriptions/{entity}/{entityId}', create: '/subscriptions/{entity}/{entityId}',

View file

@ -14,7 +14,7 @@ const parseDate = date => {
return null return null
} }
export default class TaskService extends AbstractService { export default class TaskService extends AbstractService<ITask> {
constructor() { constructor() {
super({ super({
create: '/lists/{listId}', create: '/lists/{listId}',

View file

@ -1,8 +1,8 @@
import AbstractService from './abstractService' import AbstractService from './abstractService'
import TaskAssigneeModel from '../models/taskAssignee' import TaskAssigneeModel, { type ITaskAssignee } from '../models/taskAssignee'
import {formatISO} from 'date-fns' import {formatISO} from 'date-fns'
export default class TaskAssigneeService extends AbstractService { export default class TaskAssigneeService extends AbstractService<ITaskAssignee> {
constructor() { constructor() {
super({ super({
create: '/tasks/{taskId}/assignees', create: '/tasks/{taskId}/assignees',

View file

@ -1,8 +1,9 @@
import AbstractService from './abstractService'
import TaskRelationModel from '../models/taskRelation'
import {formatISO} from 'date-fns' import {formatISO} from 'date-fns'
export default class TaskRelationService extends AbstractService { import AbstractService from './abstractService'
import TaskRelationModel, {type ITaskRelation} from '@/models/taskRelation'
export default class TaskRelationService extends AbstractService<ITaskRelation> {
constructor() { constructor() {
super({ super({
create: '/tasks/{taskId}/relations', create: '/tasks/{taskId}/relations',

View file

@ -1,8 +1,8 @@
import AbstractService from './abstractService' import AbstractService from './abstractService'
import TeamModel from '../models/team' import TeamModel, { type ITeam } from '../models/team'
import {formatISO} from 'date-fns' import {formatISO} from 'date-fns'
export default class TeamService extends AbstractService { export default class TeamService extends AbstractService<ITeam> {
constructor() { constructor() {
super({ super({
create: '/teams', create: '/teams',

View file

@ -1,9 +1,9 @@
import AbstractService from './abstractService' import AbstractService from './abstractService'
import TeamListModel from '../models/teamList' import TeamListModel, { type ITeamList } from '../models/teamList'
import TeamModel from '../models/team' import TeamModel from '../models/team'
import {formatISO} from 'date-fns' import {formatISO} from 'date-fns'
export default class TeamListService extends AbstractService { export default class TeamListService extends AbstractService<ITeamList> {
constructor() { constructor() {
super({ super({
create: '/lists/{listId}/teams', create: '/lists/{listId}/teams',

View file

@ -1,8 +1,8 @@
import AbstractService from './abstractService' import AbstractService from './abstractService'
import TeamMemberModel from '../models/teamMember' import TeamMemberModel, { type ITeamMember } from '../models/teamMember'
import {formatISO} from 'date-fns' import {formatISO} from 'date-fns'
export default class TeamMemberService extends AbstractService { export default class TeamMemberService extends AbstractService<ITeamMember> {
constructor() { constructor() {
super({ super({
create: '/teams/{teamId}/members', create: '/teams/{teamId}/members',

View file

@ -1,9 +1,9 @@
import AbstractService from './abstractService' import AbstractService from './abstractService'
import TeamNamespaceModel from '../models/teamNamespace' import TeamNamespaceModel, { type ITeamNamespace } from '../models/teamNamespace'
import TeamModel from '../models/team' import TeamModel from '../models/team'
import {formatISO} from 'date-fns' import {formatISO} from 'date-fns'
export default class TeamNamespaceService extends AbstractService { export default class TeamNamespaceService extends AbstractService<ITeamNamespace> {
constructor() { constructor() {
super({ super({
create: '/namespaces/{namespaceId}/teams', create: '/namespaces/{namespaceId}/teams',

View file

@ -1,7 +1,7 @@
import AbstractService from './abstractService' import AbstractService from './abstractService'
import TotpModel from '../models/totp' import TotpModel, { type ITotp } from '@/models/totp'
export default class TotpService extends AbstractService { export default class TotpService extends AbstractService<ITotp> {
urlPrefix = '/user/settings/totp' urlPrefix = '/user/settings/totp'
constructor() { constructor() {

View file

@ -1,8 +1,8 @@
import AbstractService from './abstractService' import AbstractService from './abstractService'
import UserModel from '../models/user' import UserModel, { type IUser } from '../models/user'
import {formatISO} from 'date-fns' import {formatISO} from 'date-fns'
export default class UserService extends AbstractService { export default class UserService extends AbstractService<IUser> {
constructor() { constructor() {
super({ super({
getAll: '/users', getAll: '/users',

View file

@ -1,9 +1,9 @@
import AbstractService from './abstractService' import AbstractService from './abstractService'
import UserListModel from '../models/userList' import UserListModel, { type IUserList } from '../models/userList'
import UserModel from '../models/user' import UserModel from '../models/user'
import {formatISO} from 'date-fns' import {formatISO} from 'date-fns'
export default class UserListService extends AbstractService { export default class UserListService extends AbstractService<IUserList> {
constructor() { constructor() {
super({ super({
create: '/lists/{listId}/users', create: '/lists/{listId}/users',

View file

@ -1,9 +1,9 @@
import AbstractService from './abstractService' import AbstractService from './abstractService'
import UserNamespaceModel from '../models/userNamespace' import UserNamespaceModel, { type IUserNamespace } from '../models/userNamespace'
import UserModel from '../models/user' import UserModel from '../models/user'
import {formatISO} from 'date-fns' import {formatISO} from 'date-fns'
export default class UserNamespaceService extends AbstractService { export default class UserNamespaceService extends AbstractService<IUserNamespace> {
constructor() { constructor() {
super({ super({
create: '/namespaces/{namespaceId}/users', create: '/namespaces/{namespaceId}/users',

View file

@ -1,7 +1,8 @@
import type { IUserSettings } from '@/models/userSettings'
import AbstractService from './abstractService' import AbstractService from './abstractService'
export default class UserSettingsService extends AbstractService { export default class UserSettingsService extends AbstractService<IUserSettings> {
constructor() { constructor() {
super({ super({
update: '/user/settings/general', update: '/user/settings/general',