misc_pterodactyl-panel/resources/scripts/api/definitions/user/transformers.ts
2022-02-27 11:04:50 -05:00

24 lines
804 B
TypeScript

import * as Models from './models';
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,
};
}
}