105 lines
2.6 KiB
TypeScript
105 lines
2.6 KiB
TypeScript
import type { EntitySnapshot } from "@/types/entities";
|
|
import type { FeatureCollection, GeometrySnapshot, LinkScopeSnapshot } from "@/types/geo";
|
|
|
|
export type SectionStatus = "editing" | "submitted" | "approved" | "rejected";
|
|
export type SectionCommitKind = "manual" | "restore";
|
|
export type SectionSubmissionStatus = "pending" | "approved" | "rejected" | "conflicted";
|
|
|
|
export type SectionState = {
|
|
section_id?: string;
|
|
status: SectionStatus;
|
|
head_commit_id: string | null;
|
|
version: number;
|
|
locked_by: string | null;
|
|
locked_at: string | null;
|
|
lock_expires_at: string | null;
|
|
updated_at?: string;
|
|
};
|
|
|
|
export type Section = {
|
|
id: string;
|
|
title: string;
|
|
description: string | null;
|
|
user_id: string | null;
|
|
created_by: string | null;
|
|
created_at: string;
|
|
updated_at: string;
|
|
state: Omit<SectionState, "section_id" | "updated_at">;
|
|
};
|
|
|
|
export type SectionCommit = {
|
|
id: string;
|
|
section_id: string;
|
|
parent_commit_id: string | null;
|
|
commit_no: number;
|
|
kind: SectionCommitKind;
|
|
restored_from_commit_id: string | null;
|
|
created_by: string;
|
|
created_at: string;
|
|
title: string | null;
|
|
note: string | null;
|
|
snapshot_hash: string | null;
|
|
snapshot?: EditorSnapshot | null;
|
|
};
|
|
|
|
export type SectionSubmission = {
|
|
id: string;
|
|
section_id: string;
|
|
commit_id: string;
|
|
submitted_by: string;
|
|
submitted_at: string;
|
|
status: SectionSubmissionStatus;
|
|
reviewed_by: string | null;
|
|
reviewed_at: string | null;
|
|
review_note: string | null;
|
|
snapshot_hash: string | null;
|
|
snapshot?: EditorSnapshot | null;
|
|
};
|
|
|
|
export type EditorSnapshot = {
|
|
schema_version: number;
|
|
section: {
|
|
id: string;
|
|
title: string;
|
|
};
|
|
editor_feature_collection?: FeatureCollection;
|
|
entities?: EntitySnapshot[];
|
|
geometries?: GeometrySnapshot[];
|
|
link_scopes?: LinkScopeSnapshot[];
|
|
};
|
|
|
|
export type EditorLoadResponse = {
|
|
section: Section;
|
|
state: SectionState;
|
|
commit: SectionCommit | null;
|
|
snapshot: EditorSnapshot | null;
|
|
};
|
|
|
|
export type CreateSectionInput = {
|
|
id?: string;
|
|
title: string;
|
|
description?: string | null;
|
|
user_id?: string;
|
|
created_by?: string;
|
|
};
|
|
|
|
export type CreateCommitInput = {
|
|
snapshot: EditorSnapshot;
|
|
created_by?: string;
|
|
user_id?: string;
|
|
expected_version?: number;
|
|
expected_head_commit_id?: string | null;
|
|
title?: string | null;
|
|
note?: string | null;
|
|
};
|
|
|
|
export type RestoreCommitInput = {
|
|
commit_id: string;
|
|
created_by?: string;
|
|
user_id?: string;
|
|
expected_version?: number;
|
|
expected_head_commit_id?: string | null;
|
|
title?: string | null;
|
|
note?: string | null;
|
|
};
|