feat: add soft-delete API functions and deleted_at to Site type
This commit is contained in:
@@ -26,6 +26,7 @@ export interface Site {
|
|||||||
is_verified?: boolean
|
is_verified?: boolean
|
||||||
created_at: string
|
created_at: string
|
||||||
updated_at: string
|
updated_at: string
|
||||||
|
deleted_at?: string | null
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface CreateSiteRequest {
|
export interface CreateSiteRequest {
|
||||||
@@ -77,8 +78,8 @@ export async function updateSite(id: string, data: UpdateSiteRequest): Promise<S
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function deleteSite(id: string): Promise<void> {
|
export async function deleteSite(id: string): Promise<{ message: string; purge_at: string }> {
|
||||||
await apiRequest(`/sites/${id}`, {
|
return apiRequest<{ message: string; purge_at: string }>(`/sites/${id}`, {
|
||||||
method: 'DELETE',
|
method: 'DELETE',
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
@@ -94,3 +95,20 @@ export async function verifySite(id: string): Promise<void> {
|
|||||||
method: 'POST',
|
method: 'POST',
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export async function restoreSite(id: string): Promise<void> {
|
||||||
|
await apiRequest(`/sites/${id}/restore`, {
|
||||||
|
method: 'POST',
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
export async function permanentDeleteSite(id: string): Promise<void> {
|
||||||
|
await apiRequest(`/sites/${id}/permanent`, {
|
||||||
|
method: 'DELETE',
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
export async function listDeletedSites(): Promise<Site[]> {
|
||||||
|
const response = await apiRequest<{ sites: Site[] }>('/sites/deleted')
|
||||||
|
return response?.sites || []
|
||||||
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user