@striae-org/striae 5.5.2 → 6.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +3 -1
- package/app/components/actions/case-export/download-handlers.ts +130 -62
- package/app/components/actions/case-manage/archive-package-builder.ts +299 -0
- package/app/components/actions/case-manage/delete-helpers.ts +61 -0
- package/app/components/actions/case-manage/index.ts +2 -0
- package/app/components/actions/case-manage/operations.ts +714 -0
- package/app/components/actions/case-manage/types.ts +21 -0
- package/app/components/actions/case-manage/utils.ts +34 -0
- package/app/components/actions/case-manage.ts +1 -1079
- package/app/components/navbar/case-import/case-import.module.css +2 -2
- package/app/components/navbar/case-import/case-import.tsx +0 -8
- package/app/components/navbar/case-import/components/CasePreviewSection.tsx +1 -1
- package/app/components/navbar/case-modals/all-cases-modal.tsx +13 -1
- package/app/components/navbar/navbar.tsx +8 -5
- package/app/components/sidebar/cases/case-sidebar.tsx +3 -2
- package/app/components/sidebar/sidebar-container.tsx +7 -0
- package/{members.emails.example → app/config-example/members.emails} +1 -1
- package/{primershear.emails.example → app/config-example/primershear.emails} +1 -1
- package/app/routes/striae/striae.tsx +36 -11
- package/app/types/export.ts +1 -0
- package/app/utils/forensics/SHA256.ts +2 -2
- package/app/utils/forensics/audit-export-signature.ts +1 -1
- package/app/utils/forensics/confirmation-signature.ts +1 -1
- package/app/utils/forensics/signature-utils.ts +7 -2
- package/package.json +2 -4
- package/scripts/deploy-config.sh +33 -0
- package/scripts/deploy-members-emails.sh +4 -4
- package/scripts/deploy-primershear-emails.sh +3 -3
- package/workers/audit-worker/package.json +1 -1
- package/workers/audit-worker/wrangler.jsonc.example +1 -1
- package/workers/data-worker/package.json +1 -1
- package/workers/data-worker/src/signature-utils.ts +7 -2
- package/workers/data-worker/src/signing-payload-utils.ts +4 -4
- package/workers/data-worker/wrangler.jsonc.example +1 -1
- package/workers/image-worker/package.json +1 -1
- package/workers/image-worker/wrangler.jsonc.example +1 -1
- package/workers/pdf-worker/package.json +1 -1
- package/workers/pdf-worker/wrangler.jsonc.example +1 -1
- package/workers/user-worker/package.json +1 -1
- package/workers/user-worker/wrangler.jsonc.example +1 -1
- package/wrangler.toml.example +1 -1
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import type { User } from 'firebase/auth';
|
|
2
|
+
import { type CaseData, type FileData } from '~/types';
|
|
3
|
+
import { fetchImageApi } from '~/utils/api';
|
|
4
|
+
import { deleteFileAnnotations, getCaseData, updateCaseData } from '~/utils/data';
|
|
5
|
+
import { type DeleteFileWithoutAuditOptions, type DeleteFileWithoutAuditResult } from './types';
|
|
6
|
+
|
|
7
|
+
export const deleteFileWithoutAudit = async (
|
|
8
|
+
user: User,
|
|
9
|
+
caseNumber: string,
|
|
10
|
+
fileId: string,
|
|
11
|
+
options: DeleteFileWithoutAuditOptions = {}
|
|
12
|
+
): Promise<DeleteFileWithoutAuditResult> => {
|
|
13
|
+
const caseData = await getCaseData(user, caseNumber, {
|
|
14
|
+
skipValidation: options.skipValidation === true,
|
|
15
|
+
});
|
|
16
|
+
if (!caseData) {
|
|
17
|
+
throw new Error('Case not found');
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
const fileToDelete = (caseData.files || []).find((f: FileData) => f.id === fileId);
|
|
21
|
+
if (!fileToDelete) {
|
|
22
|
+
throw new Error('File not found in case');
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
let imageMissing = false;
|
|
26
|
+
|
|
27
|
+
const imageResponse = await fetchImageApi(user, `/${encodeURIComponent(fileId)}`, {
|
|
28
|
+
method: 'DELETE',
|
|
29
|
+
});
|
|
30
|
+
|
|
31
|
+
if (!imageResponse.ok && imageResponse.status === 404) {
|
|
32
|
+
imageMissing = true;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
if (!imageResponse.ok && imageResponse.status !== 404) {
|
|
36
|
+
throw new Error(`Failed to delete image: ${imageResponse.status} ${imageResponse.statusText}`);
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
await deleteFileAnnotations(user, caseNumber, fileId, {
|
|
40
|
+
skipValidation: options.skipValidation === true,
|
|
41
|
+
});
|
|
42
|
+
|
|
43
|
+
if (options.skipCaseDataUpdate === true) {
|
|
44
|
+
return {
|
|
45
|
+
imageMissing,
|
|
46
|
+
fileName: fileToDelete.originalFilename,
|
|
47
|
+
};
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
const updatedData: CaseData = {
|
|
51
|
+
...caseData,
|
|
52
|
+
files: (caseData.files || []).filter((f: FileData) => f.id !== fileId),
|
|
53
|
+
};
|
|
54
|
+
|
|
55
|
+
await updateCaseData(user, caseNumber, updatedData);
|
|
56
|
+
|
|
57
|
+
return {
|
|
58
|
+
imageMissing,
|
|
59
|
+
fileName: fileToDelete.originalFilename,
|
|
60
|
+
};
|
|
61
|
+
};
|