mirror of
https://github.com/khairul169/garage-webui.git
synced 2025-10-14 23:09:32 +07:00

- Updated HTTP methods for bucket and key operations to align with the official Garage Admin API v2 specifications, changing DELETE methods to POST where necessary. - Modified frontend hooks and documentation to reflect these changes, ensuring consistency across the application. - Completed tasks for verifying and aligning delete operations and reviewing other HTTP methods.
25 lines
739 B
TypeScript
25 lines
739 B
TypeScript
import { z } from "zod";
|
|
|
|
export const createKeySchema = z
|
|
.object({
|
|
name: z
|
|
.string()
|
|
.min(1, "Key Name is required")
|
|
.regex(/^[a-zA-Z0-9_-]+$/, "Key Name invalid"),
|
|
isImport: z.boolean().default(false),
|
|
accessKeyId: z.string().optional(),
|
|
secretAccessKey: z.string().optional(),
|
|
})
|
|
.refine(
|
|
(v) => !v.isImport || (v.accessKeyId != null && v.accessKeyId.length > 0),
|
|
{ message: "Access key ID is required", path: ["accessKeyId"] }
|
|
)
|
|
.refine(
|
|
(v) =>
|
|
!v.isImport ||
|
|
(v.secretAccessKey != null && v.secretAccessKey.length > 0),
|
|
{ message: "Secret access key is required", path: ["secretAccessKey"] }
|
|
);
|
|
|
|
export type CreateKeySchema = z.infer<typeof createKeySchema>;
|