feat(admin): add typed models for admin users and overview
This commit is contained in:
parent
825e45b4c8
commit
c9b3d4775c
|
|
@ -0,0 +1,26 @@
|
|||
import type {IAbstract} from './IAbstract'
|
||||
|
||||
export interface IAdminOverviewShares {
|
||||
linkShares: number
|
||||
teamShares: number
|
||||
userShares: number
|
||||
}
|
||||
|
||||
export interface IAdminOverviewLicense {
|
||||
licensed: boolean
|
||||
instanceId: string
|
||||
features: string[]
|
||||
maxUsers: number
|
||||
expiresAt: Date
|
||||
validatedAt: Date
|
||||
lastCheckFailed: boolean
|
||||
}
|
||||
|
||||
export interface IAdminOverview extends IAbstract {
|
||||
users: number
|
||||
projects: number
|
||||
tasks: number
|
||||
teams: number
|
||||
shares: IAdminOverviewShares
|
||||
license: IAdminOverviewLicense
|
||||
}
|
||||
|
|
@ -0,0 +1,9 @@
|
|||
import type {IUser} from './IUser'
|
||||
|
||||
export interface IAdminUser extends IUser {
|
||||
status: number
|
||||
isAdmin: boolean
|
||||
issuer: string
|
||||
subject?: string
|
||||
authProvider?: string
|
||||
}
|
||||
|
|
@ -0,0 +1,31 @@
|
|||
import AbstractModel from './abstractModel'
|
||||
import type {IAdminOverview, IAdminOverviewLicense, IAdminOverviewShares} from '@/modelTypes/IAdminOverview'
|
||||
|
||||
export default class AdminOverviewModel extends AbstractModel<IAdminOverview> implements IAdminOverview {
|
||||
users = 0
|
||||
projects = 0
|
||||
tasks = 0
|
||||
teams = 0
|
||||
shares: IAdminOverviewShares = {
|
||||
linkShares: 0,
|
||||
teamShares: 0,
|
||||
userShares: 0,
|
||||
}
|
||||
license: IAdminOverviewLicense = {
|
||||
licensed: false,
|
||||
instanceId: '',
|
||||
features: [],
|
||||
maxUsers: 0,
|
||||
expiresAt: new Date(0),
|
||||
validatedAt: new Date(0),
|
||||
lastCheckFailed: false,
|
||||
}
|
||||
|
||||
constructor(data: Partial<IAdminOverview> = {}) {
|
||||
super()
|
||||
this.assignData(data)
|
||||
|
||||
this.license.expiresAt = new Date(this.license.expiresAt)
|
||||
this.license.validatedAt = new Date(this.license.validatedAt)
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,14 @@
|
|||
import UserModel from '@/models/user'
|
||||
import type {IAdminUser} from '@/modelTypes/IAdminUser'
|
||||
|
||||
export default class AdminUserModel extends UserModel implements IAdminUser {
|
||||
declare status: number
|
||||
declare isAdmin: boolean
|
||||
declare issuer: string
|
||||
declare subject?: string
|
||||
declare authProvider?: string
|
||||
|
||||
constructor(data: Partial<IAdminUser> = {}) {
|
||||
super(data)
|
||||
}
|
||||
}
|
||||
Loading…
Reference in New Issue