mirror of
https://github.com/outline/outline.git
synced 2026-12-01 01:14:11 +03:00
35 lines
941 B
TypeScript
35 lines
941 B
TypeScript
import { z } from "zod";
|
|
import { RelationshipType } from "@server/models/Relationship";
|
|
import { ValidateDocumentId } from "@server/validation";
|
|
import { BaseSchema } from "../schema";
|
|
|
|
export const RelationshipsInfoSchema = BaseSchema.extend({
|
|
body: z.object({
|
|
id: z.uuid(),
|
|
}),
|
|
});
|
|
|
|
export type RelationshipsInfoReq = z.infer<typeof RelationshipsInfoSchema>;
|
|
|
|
export const RelationshipsListSchema = BaseSchema.extend({
|
|
body: z
|
|
.object({
|
|
type: z.enum(RelationshipType).optional(),
|
|
documentId: z
|
|
.string()
|
|
.refine(ValidateDocumentId.isValid, {
|
|
message: ValidateDocumentId.message,
|
|
})
|
|
.optional(),
|
|
reverseDocumentId: z
|
|
.string()
|
|
.refine(ValidateDocumentId.isValid, {
|
|
message: ValidateDocumentId.message,
|
|
})
|
|
.optional(),
|
|
})
|
|
.optional(),
|
|
});
|
|
|
|
export type RelationshipsListReq = z.infer<typeof RelationshipsListSchema>;
|