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'
interface ILabel extends AbstractModel {
export interface ILabelTask extends AbstractModel {
id: number
taskId: number
labelId: number
}
export default class LabelTask extends AbstractModel implements ILabel {
export default class LabelTask extends AbstractModel implements ILabelTask {
declare id: number
declare taskId: number
declare labelId: number

View file

@ -2,13 +2,13 @@ import AbstractModel from './abstractModel'
import ListModel, { type IList } from './list'
import type { INamespace } from './namespace'
export interface ListDuplicate extends AbstractModel {
export interface IListDuplicate extends AbstractModel {
listId: number
namespaceId: INamespace['id']
list: IList
}
export default class ListDuplicateModel extends AbstractModel implements ListDuplicate {
export default class ListDuplicateModel extends AbstractModel implements IListDuplicate {
declare listId: number
declare namespaceId: INamespace['id']
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 interface ITaskRelationModel extends AbstractModel {
export interface ITaskRelation extends AbstractModel {
id: number
otherTaskId: ITask['id']
taskId: ITask['id']
@ -29,7 +29,7 @@ export interface ITaskRelationModel extends AbstractModel {
created: Date
}
export default class TaskRelationModel extends AbstractModel implements ITaskRelationModel {
export default class TaskRelationModel extends AbstractModel implements ITaskRelation {
declare id: number
declare otherTaskId: ITask['id']
declare taskId: ITask['id']

View file

@ -1,7 +1,7 @@
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() {
super({
create: '/tasks/{taskId}/labels',

View file

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

View file

@ -1,7 +1,7 @@
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() {
super({
create: '/lists/{listId}/duplicate',

View file

@ -1,8 +1,8 @@
import AbstractService from '@/services/abstractService'
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() {
super({
getAll: '/notifications',

View file

@ -1,7 +1,7 @@
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() {
super({})

View file

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

View file

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

View file

@ -1,7 +1,7 @@
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() {
super({
create: '/subscriptions/{entity}/{entityId}',

View file

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

View file

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

View file

@ -1,8 +1,9 @@
import AbstractService from './abstractService'
import TaskRelationModel from '../models/taskRelation'
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() {
super({
create: '/tasks/{taskId}/relations',

View file

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

View file

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

View file

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

View file

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

View file

@ -1,7 +1,7 @@
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'
constructor() {

View file

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

View file

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

View file

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

View file

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