forked from Alex/Pterodactyl-Panel
More fixup for egg handling
This commit is contained in:
parent
85c8f4884f
commit
8486c914ae
@ -51,18 +51,18 @@ export interface EggVariable extends Model {
|
|||||||
export const getEgg = async (id: number | string): Promise<WithRelationships<Egg, 'nest' | 'variables'>> => {
|
export const getEgg = async (id: number | string): Promise<WithRelationships<Egg, 'nest' | 'variables'>> => {
|
||||||
const { data } = await http.get(`/api/application/eggs/${id}`, {
|
const { data } = await http.get(`/api/application/eggs/${id}`, {
|
||||||
params: {
|
params: {
|
||||||
includes: [ 'nest', 'variables' ],
|
include: [ 'nest', 'variables' ],
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
return withRelationships(AdminTransformers.toEgg(data.data), 'nest', 'variables');
|
return withRelationships(AdminTransformers.toEgg(data), 'nest', 'variables');
|
||||||
};
|
};
|
||||||
|
|
||||||
export const searchEggs = async (nestId: number, params: QueryBuilderParams<'name'>): Promise<WithRelationships<Egg, 'variables'>[]> => {
|
export const searchEggs = async (nestId: number, params: QueryBuilderParams<'name'>): Promise<WithRelationships<Egg, 'variables'>[]> => {
|
||||||
const { data } = await http.get(`/api/application/nests/${nestId}/eggs`, {
|
const { data } = await http.get(`/api/application/nests/${nestId}/eggs`, {
|
||||||
params: {
|
params: {
|
||||||
...withQueryBuilderParams(params),
|
...withQueryBuilderParams(params),
|
||||||
includes: [ 'variables' ],
|
include: [ 'variables' ],
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -60,7 +60,7 @@ export interface Node extends Model {
|
|||||||
export const getNode = async (id: string | number): Promise<WithRelationships<Node, 'location'>> => {
|
export const getNode = async (id: string | number): Promise<WithRelationships<Node, 'location'>> => {
|
||||||
const { data } = await http.get(`/api/application/nodes/${id}`, {
|
const { data } = await http.get(`/api/application/nodes/${id}`, {
|
||||||
params: {
|
params: {
|
||||||
includes: [ 'location' ],
|
include: [ 'location' ],
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -79,7 +79,7 @@ type LoadedServer = WithRelationships<Server, 'allocations' | 'user' | 'node'>;
|
|||||||
export const getServer = async (id: number | string): Promise<LoadedServer> => {
|
export const getServer = async (id: number | string): Promise<LoadedServer> => {
|
||||||
const { data } = await http.get(`/api/application/servers/${id}`, {
|
const { data } = await http.get(`/api/application/servers/${id}`, {
|
||||||
params: {
|
params: {
|
||||||
includes: [ 'allocations', 'user', 'node' ],
|
include: [ 'allocations', 'user', 'node' ],
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -88,7 +88,7 @@ export class AdminTransformers {
|
|||||||
createdAt: new Date(attributes.created_at),
|
createdAt: new Date(attributes.created_at),
|
||||||
updatedAt: new Date(attributes.updated_at),
|
updatedAt: new Date(attributes.updated_at),
|
||||||
relationships: {
|
relationships: {
|
||||||
location: transform(attributes.relationships!.location as FractalResponseData, this.toLocation),
|
location: transform(attributes.relationships?.location as FractalResponseData, this.toLocation),
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
Loading…
Reference in New Issue
Block a user