refactor: redesign document history model

This commit is contained in:
vran
2022-03-07 23:13:30 +08:00
parent fca7bd788e
commit 6a3c5fe311
23 changed files with 331 additions and 948 deletions

View File

@@ -3,6 +3,7 @@ package com.databasir.api;
import com.databasir.common.JsonData;
import com.databasir.common.SystemException;
import com.databasir.core.domain.document.data.DatabaseDocumentResponse;
import com.databasir.core.domain.document.data.DatabaseDocumentSimpleResponse;
import com.databasir.core.domain.document.data.DatabaseDocumentVersionResponse;
import com.databasir.core.domain.document.service.DocumentService;
import com.databasir.core.domain.log.annotation.Operation;
@@ -54,7 +55,7 @@ public class DocumentController {
@PageableDefault(sort = "id",
direction = DESC)
Pageable page) {
return JsonData.ok(documentService.getVersionsBySchemaSourceId(projectId, page));
return JsonData.ok(documentService.getVersionsByProjectId(projectId, page));
}
@GetMapping(Routes.Document.EXPORT)
@@ -79,4 +80,16 @@ public class DocumentController {
}
}
@GetMapping(Routes.Document.GET_SIMPLE_ONE)
public JsonData<DatabaseDocumentSimpleResponse> getSimpleByProjectId(@PathVariable Integer projectId,
@RequestParam(required = false) Long version) {
return JsonData.ok(documentService.getSimpleOneByProjectId(projectId, version));
}
@GetMapping(Routes.Document.GET_TABLE_DETAIL)
public JsonData<DatabaseDocumentResponse.TableDocumentResponse> getTableDocument(@PathVariable Integer projectId,
@PathVariable Integer tableId) {
return JsonData.ok(documentService.getTableDetails(projectId, tableId));
}
}

View File

@@ -78,6 +78,10 @@ public interface Routes {
String LIST_VERSIONS = BASE + "/projects/{projectId}/document_versions";
String GET_SIMPLE_ONE = BASE + "/projects/{projectId}/documents/simple";
String GET_TABLE_DETAIL = BASE + "/projects/{projectId}/table_documents/{tableId}";
String EXPORT = BASE + "/projects/{projectId}/document_files";
}