Skip to content

Commit 3a5cc30

Browse files
committed
refactor: use openapi validation document types
Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com>
1 parent 9632e1c commit 3a5cc30

1 file changed

Lines changed: 9 additions & 20 deletions

File tree

src/components/validation/DocumentValidationDetails.vue

Lines changed: 9 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
{{ document.totalPages }}
2424
</template>
2525
</NcListItem>
26-
<NcListItem v-if="document.size" class="extra" compact>
26+
<NcListItem class="extra" compact>
2727
<template #name>
2828
<strong>{{ t('libresign', 'File size:') }}</strong>
2929
{{ size }}
@@ -68,26 +68,17 @@ import {
6868
import { getStatusLabel } from '../../utils/fileStatus.js'
6969
import { openDocument } from '../../utils/viewer.js'
7070
import SignerDetails from './SignerDetails.vue'
71-
import type { SignerDetailRecord, SignerSummaryRecord } from '../../types/index'
71+
import type {
72+
LoadedValidationFileDocument,
73+
ValidatedChildFileRecord,
74+
} from '../../types/index'
7275
7376
defineOptions({
7477
name: 'DocumentValidationDetails',
7578
})
7679
77-
type ValidationSigner = Partial<SignerSummaryRecord | SignerDetailRecord>
78-
type ValidationDocument = {
79-
uuid?: string
80-
name?: string
81-
nodeId?: number
82-
totalPages?: number
83-
pdfVersion?: string
84-
status?: string | number
85-
size?: string | number
86-
signers?: ValidationSigner[]
87-
}
88-
8980
const props = withDefaults(defineProps<{
90-
document: ValidationDocument
81+
document: LoadedValidationFileDocument | ValidatedChildFileRecord
9182
legalInformation?: string
9283
documentValidMessage?: string
9384
isAfterSigned?: boolean
@@ -100,11 +91,9 @@ const props = withDefaults(defineProps<{
10091
const { document } = toRefs(props)
10192
10293
const size = computed(() => {
103-
if (!document.value.size) return ''
104-
const parsedSize = parseInt(String(document.value.size), 10)
105-
if (parsedSize < 1024) return parsedSize + ' B'
106-
if (parsedSize < 1048576) return (parsedSize / 1024).toFixed(2) + ' KB'
107-
return (parsedSize / 1048576).toFixed(2) + ' MB'
94+
if (document.value.size < 1024) return document.value.size + ' B'
95+
if (document.value.size < 1048576) return (document.value.size / 1024).toFixed(2) + ' KB'
96+
return (document.value.size / 1048576).toFixed(2) + ' MB'
10897
})
10998
11099
const documentStatus = computed(() => getStatusLabel(document.value.status))

0 commit comments

Comments
 (0)