revision.ts 915 B

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. import type { HasObjectId } from './has-object-id';
  2. import type { IUser } from './user';
  3. export const Origin = {
  4. View: 'view',
  5. Editor: 'editor',
  6. } as const;
  7. export type Origin = typeof Origin[keyof typeof Origin];
  8. export const allOrigin = Object.values(Origin);
  9. export type IRevision = {
  10. body: string,
  11. author: IUser,
  12. hasDiffToPrev: boolean;
  13. createdAt: Date,
  14. updatedAt: Date,
  15. origin?: Origin,
  16. }
  17. export type IRevisionHasId = IRevision & HasObjectId;
  18. type HasPageId = {
  19. pageId: string,
  20. };
  21. export type IRevisionHasPageId = IRevisionHasId & HasPageId;
  22. export type IRevisionsForPagination = {
  23. revisions: IRevisionHasPageId[], // revisions in one pagination
  24. totalCounts: number // total counts
  25. }
  26. export type HasRevisionShortbody = {
  27. revisionShortBody?: string,
  28. }
  29. export type SWRInfinitePageRevisionsResponse = {
  30. revisions: IRevisionHasPageId[],
  31. totalCount: number,
  32. offset: number,
  33. }