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
|
* List of snapshots
|
||||||
*/
|
*/
|
||||||
200: {
|
200: Array<{
|
||||||
snapshots: Array<{
|
duration: number;
|
||||||
duration: number;
|
paths: Array<string>;
|
||||||
paths: Array<string>;
|
short_id: string;
|
||||||
short_id: string;
|
size: number;
|
||||||
size: number;
|
time: number;
|
||||||
time: number;
|
}>;
|
||||||
}>;
|
|
||||||
};
|
|
||||||
};
|
};
|
||||||
|
|
||||||
export type ListSnapshotsResponse = ListSnapshotsResponses[keyof ListSnapshotsResponses];
|
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 Volume = GetVolumeResponse["volume"];
|
||||||
export type StatFs = GetVolumeResponse["statfs"];
|
export type StatFs = GetVolumeResponse["statfs"];
|
||||||
@@ -9,3 +15,5 @@ export type User = GetMeResponse["user"];
|
|||||||
export type Repository = GetRepositoryResponse;
|
export type Repository = GetRepositoryResponse;
|
||||||
|
|
||||||
export type BackupSchedule = GetBackupScheduleResponse;
|
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>(snapshots, 200);
|
||||||
|
|
||||||
return c.json<ListSnapshotsDto>(response, 200);
|
|
||||||
})
|
})
|
||||||
.get(
|
.get(
|
||||||
"/:name/snapshots/:snapshotId/files",
|
"/:name/snapshots/:snapshotId/files",
|
||||||
|
|||||||
@@ -139,9 +139,7 @@ export const snapshotSchema = type({
|
|||||||
duration: "number",
|
duration: "number",
|
||||||
});
|
});
|
||||||
|
|
||||||
const listSnapshotsResponse = type({
|
const listSnapshotsResponse = snapshotSchema.array();
|
||||||
snapshots: snapshotSchema.array(),
|
|
||||||
});
|
|
||||||
|
|
||||||
export type ListSnapshotsDto = typeof listSnapshotsResponse.infer;
|
export type ListSnapshotsDto = typeof listSnapshotsResponse.infer;
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
import { defaultPlugins, defineConfig } from "@hey-api/openapi-ts";
|
import { defaultPlugins, defineConfig } from "@hey-api/openapi-ts";
|
||||||
|
|
||||||
export default defineConfig({
|
export default defineConfig({
|
||||||
input: "http://localhost:4096/api/v1/openapi.json",
|
input: "http://192.168.2.42:4096/api/v1/openapi.json",
|
||||||
output: {
|
output: {
|
||||||
path: "./apps/client/app/api-client",
|
path: "./apps/client/app/api-client",
|
||||||
format: "biome",
|
format: "biome",
|
||||||
|
|||||||
Reference in New Issue
Block a user