mirror of
https://github.com/outline/outline.git
synced 2026-11-21 13:34:02 +03:00
* Revert "Revert "Move document history to `revisions.list` API (#8458)" (#8495)"
This reverts commit 2116041cd5.
* fix: check all events for latest ad-hoc revision
* view revision list for deleted docs
* rename
---------
Co-authored-by: hmacr <hmac.devo@gmail.com>
49 lines
1.3 KiB
TypeScript
49 lines
1.3 KiB
TypeScript
import { z } from "zod";
|
|
import { EventHelper } from "@shared/utils/EventHelper";
|
|
import { BaseSchema } from "@server/routes/api/schema";
|
|
|
|
export const EventsListSchema = BaseSchema.extend({
|
|
body: z.object({
|
|
/** Events to retrieve */
|
|
events: z
|
|
.array(
|
|
z.union([
|
|
z.enum(EventHelper.ACTIVITY_EVENTS),
|
|
z.enum(EventHelper.AUDIT_EVENTS),
|
|
])
|
|
)
|
|
.optional(),
|
|
|
|
/** Id of the user who performed the action */
|
|
actorId: z.string().uuid().optional(),
|
|
|
|
/** Id of the document to filter the events for */
|
|
documentId: z.string().uuid().optional(),
|
|
|
|
/** Id of the collection to filter the events for */
|
|
collectionId: z.string().uuid().optional(),
|
|
|
|
/** Whether to include audit events */
|
|
auditLog: z.boolean().default(false),
|
|
|
|
/** @deprecated, use 'events' parameter instead
|
|
* Name of the event to retrieve
|
|
*/
|
|
name: z.string().optional(),
|
|
|
|
/** The attribute to sort the events by */
|
|
sort: z
|
|
.string()
|
|
.refine((val) => ["name", "createdAt"].includes(val))
|
|
.default("createdAt"),
|
|
|
|
/** The direction to sort the events */
|
|
direction: z
|
|
.string()
|
|
.optional()
|
|
.transform((val) => (val !== "ASC" ? "DESC" : val)),
|
|
}),
|
|
});
|
|
|
|
export type EventsListReq = z.infer<typeof EventsListSchema>;
|