misc_pterodactyl-panel/resources/scripts/api/definitions/user/transformers.ts

25 lines
804 B
TypeScript
Raw Normal View History

2022-02-27 16:04:50 +00:00
import * as Models from './models';
2022-02-13 20:44:19 +00:00
export default class Transformers {
static toSecurityKey (data: Record<string, any>): Models.SecurityKey {
return {
uuid: data.uuid,
name: data.name,
type: data.type,
publicKeyId: data.public_key_id,
createdAt: new Date(data.created_at),
updatedAt: new Date(data.updated_at),
};
}
static toPersonalAccessToken (data: Record<string, any>): Models.PersonalAccessToken {
return {
identifier: data.token_id,
description: data.description,
createdAt: new Date(data.created_at),
updatedAt: new Date(data.updated_at),
lastUsedAt: data.last_used_at ? new Date(data.last_used_at) : null,
};
}
2022-02-13 20:44:19 +00:00
}