mirror of
https://github.com/nicotsx/ironmount.git
synced 2025-12-10 12:10:51 +01:00
refactor: snapshots flat response
This commit is contained in:
@@ -791,15 +791,13 @@ export type ListSnapshotsResponses = {
|
||||
/**
|
||||
* List of snapshots
|
||||
*/
|
||||
200: {
|
||||
snapshots: Array<{
|
||||
duration: number;
|
||||
paths: Array<string>;
|
||||
short_id: string;
|
||||
size: number;
|
||||
time: number;
|
||||
}>;
|
||||
};
|
||||
200: Array<{
|
||||
duration: number;
|
||||
paths: Array<string>;
|
||||
short_id: string;
|
||||
size: number;
|
||||
time: number;
|
||||
}>;
|
||||
};
|
||||
|
||||
export type ListSnapshotsResponse = ListSnapshotsResponses[keyof ListSnapshotsResponses];
|
||||
|
||||
@@ -1,4 +1,10 @@
|
||||
import type { GetBackupScheduleResponse, GetMeResponse, GetRepositoryResponse, GetVolumeResponse } from "~/api-client";
|
||||
import type {
|
||||
GetBackupScheduleResponse,
|
||||
GetMeResponse,
|
||||
GetRepositoryResponse,
|
||||
GetVolumeResponse,
|
||||
ListSnapshotsResponse,
|
||||
} from "~/api-client";
|
||||
|
||||
export type Volume = GetVolumeResponse["volume"];
|
||||
export type StatFs = GetVolumeResponse["statfs"];
|
||||
@@ -9,3 +15,5 @@ export type User = GetMeResponse["user"];
|
||||
export type Repository = GetRepositoryResponse;
|
||||
|
||||
export type BackupSchedule = GetBackupScheduleResponse;
|
||||
|
||||
export type Snapshot = ListSnapshotsResponse[number];
|
||||
|
||||
@@ -69,9 +69,7 @@ export const repositoriesController = new Hono()
|
||||
};
|
||||
});
|
||||
|
||||
const response = { snapshots };
|
||||
|
||||
return c.json<ListSnapshotsDto>(response, 200);
|
||||
return c.json<ListSnapshotsDto>(snapshots, 200);
|
||||
})
|
||||
.get(
|
||||
"/:name/snapshots/:snapshotId/files",
|
||||
|
||||
@@ -139,9 +139,7 @@ export const snapshotSchema = type({
|
||||
duration: "number",
|
||||
});
|
||||
|
||||
const listSnapshotsResponse = type({
|
||||
snapshots: snapshotSchema.array(),
|
||||
});
|
||||
const listSnapshotsResponse = snapshotSchema.array();
|
||||
|
||||
export type ListSnapshotsDto = typeof listSnapshotsResponse.infer;
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { defaultPlugins, defineConfig } from "@hey-api/openapi-ts";
|
||||
|
||||
export default defineConfig({
|
||||
input: "http://localhost:4096/api/v1/openapi.json",
|
||||
input: "http://192.168.2.42:4096/api/v1/openapi.json",
|
||||
output: {
|
||||
path: "./apps/client/app/api-client",
|
||||
format: "biome",
|
||||
|
||||
Reference in New Issue
Block a user