misc_pterodactyl-panel/resources/scripts/api/admin/nest.ts

26 lines
727 B
TypeScript
Raw Normal View History

import { Model, UUID } from '@/api/admin/index';
import { Egg } from '@/api/admin/egg';
import http, { QueryBuilderParams, withQueryBuilderParams } from '@/api/http';
import { AdminTransformers } from '@/api/admin/transformers';
export interface Nest extends Model {
id: number;
uuid: UUID;
author: string;
name: string;
description?: string;
createdAt: Date;
updatedAt: Date;
relationships: {
eggs?: Egg[];
};
}
export const searchNests = async (params: QueryBuilderParams<'name'>): Promise<Nest[]> => {
const { data } = await http.get('/api/application/nests', {
params: withQueryBuilderParams(params),
});
return data.data.map(AdminTransformers.toNest);
};