feat: add raw artifact audit trail
This commit is contained in:
@@ -109,6 +109,7 @@ export type IngestionRun = {
|
||||
run_id: number;
|
||||
source_id: number | null;
|
||||
source_name: string | null;
|
||||
raw_artifact_id: number | null;
|
||||
status: string;
|
||||
started_at: string;
|
||||
finished_at: string | null;
|
||||
@@ -121,6 +122,7 @@ export type CreateIngestionRun = {
|
||||
source_id?: number;
|
||||
status?: string;
|
||||
raw_uri?: string;
|
||||
raw_artifact_id?: number;
|
||||
row_count?: number;
|
||||
error_message?: string;
|
||||
};
|
||||
@@ -131,6 +133,33 @@ export type FinishIngestionRun = {
|
||||
error_message?: string;
|
||||
};
|
||||
|
||||
export type RawArtifact = {
|
||||
artifact_id: number;
|
||||
run_id: number | null;
|
||||
source_id: number | null;
|
||||
source_name: string | null;
|
||||
original_filename: string;
|
||||
raw_uri: string;
|
||||
sha256: string;
|
||||
size_bytes: number;
|
||||
mime_type: string | null;
|
||||
uploaded_by: string;
|
||||
notes: string;
|
||||
created_at: string;
|
||||
};
|
||||
|
||||
export type CreateRawArtifact = {
|
||||
run_id?: number;
|
||||
source_id?: number;
|
||||
original_filename: string;
|
||||
raw_uri: string;
|
||||
sha256: string;
|
||||
size_bytes: number;
|
||||
mime_type?: string;
|
||||
uploaded_by?: string;
|
||||
notes?: string;
|
||||
};
|
||||
|
||||
const API_BASE_URL =
|
||||
process.env.NEXT_PUBLIC_API_BASE_URL?.replace(/\/$/, "") ?? "http://127.0.0.1:8080";
|
||||
|
||||
@@ -197,6 +226,17 @@ export async function finishIngestionRun(
|
||||
});
|
||||
}
|
||||
|
||||
export async function fetchRawArtifacts(): Promise<RawArtifact[]> {
|
||||
return fetchJson("/api/v1/raw-artifacts");
|
||||
}
|
||||
|
||||
export async function createRawArtifact(payload: CreateRawArtifact): Promise<RawArtifact> {
|
||||
return fetchJson("/api/v1/raw-artifacts", {
|
||||
method: "POST",
|
||||
body: JSON.stringify(payload),
|
||||
});
|
||||
}
|
||||
|
||||
async function fetchJson<T>(path: string, init?: RequestInit): Promise<T> {
|
||||
const response = await fetch(`${API_BASE_URL}${path}`, {
|
||||
...init,
|
||||
|
||||
Reference in New Issue
Block a user