refactor(api-tokens): delete legacy resource stack

This commit is contained in:
kolaente
2026-09-30 10:42:35 +02:00
committed by Tink
parent 09ed43c776
commit 2e8a337b2f
4 changed files with 0 additions and 83 deletions
-15
View File
@@ -1,15 +0,0 @@
import type {IAbstract} from '@/modelTypes/IAbstract'
export interface IApiPermission {
[key: string]: string[]
}
export interface IApiToken extends IAbstract {
id: number
title: string
token: string
permissions: IApiPermission
expiresAt: Date
created: Date
ownerId?: number
}
@@ -1,10 +0,0 @@
import type {RouteDetail} from '@/client/generated'
export type ApiTokenRoutes = Record<string, Record<string, RouteDetail>>
export type ApiTokenPresetGroups = Record<string, string[] | '*'>
export interface ApiTokenPreset {
id: string
groups: ApiTokenPresetGroups
label?: string
}
-21
View File
@@ -1,21 +0,0 @@
import AbstractModel from '@/models/abstractModel'
import type {IApiToken, IApiPermission} from '@/modelTypes/IApiToken'
export default class ApiTokenModel extends AbstractModel<IApiToken> {
id = 0
title = ''
token = ''
permissions: IApiPermission = {}
expiresAt: Date = new Date(0)
created: Date = new Date(0)
ownerId = 0
constructor(data: Partial<IApiToken> = {}) {
super()
this.assignData(data)
this.expiresAt = new Date(this.expiresAt)
this.created = new Date(this.created)
}
}
-37
View File
@@ -1,37 +0,0 @@
import AbstractService from '@/services/abstractService'
import type {IApiToken} from '@/modelTypes/IApiToken'
import ApiTokenModel from '@/models/apiTokenModel'
import {toISOStringOrNull} from '@/helpers/time/toISOStringOrNull'
export default class ApiTokenService extends AbstractService<IApiToken> {
constructor() {
super({
create: '/tokens',
getAll: '/tokens',
delete: '/tokens/{id}',
})
}
processModel(model: IApiToken) {
return {
...model,
expiresAt: toISOStringOrNull(model.expiresAt),
created: toISOStringOrNull(model.created),
}
}
modelFactory(data: Partial<IApiToken>) {
return new ApiTokenModel(data)
}
async getAvailableRoutes() {
const cancel = this.setLoading()
try {
const response = await this.http.get('/routes')
return response.data
} finally {
cancel()
}
}
}