mirror of
https://github.com/outline/outline.git
synced 2026-06-13 11:25:03 +03:00
57b6e9aca4
closes #6930
39 lines
1.0 KiB
TypeScript
39 lines
1.0 KiB
TypeScript
import { z } from "zod";
|
|
import { BaseSchema } from "@server/routes/api/schema";
|
|
import { ApiKeyValidation } from "@shared/validations";
|
|
|
|
export const APIKeysCreateSchema = BaseSchema.extend({
|
|
body: z.object({
|
|
/** API Key name */
|
|
name: z
|
|
.string()
|
|
.trim()
|
|
.min(ApiKeyValidation.minNameLength)
|
|
.max(ApiKeyValidation.maxNameLength),
|
|
/** API Key expiry date */
|
|
expiresAt: z.coerce.date().optional(),
|
|
/** A list of scopes that this API key has access to */
|
|
scope: z.array(z.string()).optional(),
|
|
}),
|
|
});
|
|
|
|
export type APIKeysCreateReq = z.infer<typeof APIKeysCreateSchema>;
|
|
|
|
export const APIKeysListSchema = BaseSchema.extend({
|
|
body: z.object({
|
|
/** The owner of the API key */
|
|
userId: z.string().uuid().optional(),
|
|
}),
|
|
});
|
|
|
|
export type APIKeysListReq = z.infer<typeof APIKeysListSchema>;
|
|
|
|
export const APIKeysDeleteSchema = BaseSchema.extend({
|
|
body: z.object({
|
|
/** API Key Id */
|
|
id: z.string().uuid(),
|
|
}),
|
|
});
|
|
|
|
export type APIKeysDeleteReq = z.infer<typeof APIKeysDeleteSchema>;
|