#215 Change Model to use FileHash #302

Closed
eugene wants to merge 1 commits from issue-215-pdf-file-hash-to-file-hash into staging
5 changed files with 10 additions and 10 deletions
Showing only changes of commit f2f154a6c4 - Show all commits

View File

@ -39,11 +39,11 @@ const PdfView = ({
hash: string hash: string
): CurrentUserMark[] => { ): CurrentUserMark[] => {
return currentUserMarks.filter( return currentUserMarks.filter(
(currentUserMark) => currentUserMark.mark.pdfFileHash === hash (currentUserMark) => currentUserMark.mark.fileHash === hash
) )
} }
const filterMarksByFile = (marks: Mark[], hash: string): Mark[] => { const filterMarksByFile = (marks: Mark[], hash: string): Mark[] => {
return marks.filter((mark) => mark.pdfFileHash === hash) return marks.filter((mark) => mark.fileHash === hash)
} }
return ( return (
<div className="files-wrapper"> <div className="files-wrapper">

View File

@ -19,7 +19,7 @@
"page": 1 "page": 1
}, },
"npub": "npub1x77qywdllzetv9ncnhlfpv62kshlgtt0uqlsq3v22uzzkk2xvvrsn6uyfy", "npub": "npub1x77qywdllzetv9ncnhlfpv62kshlgtt0uqlsq3v22uzzkk2xvvrsn6uyfy",
"pdfFileHash": "da5f857e77d3aa59c461efad804116931c059b36e6b4da0b5d9452753ec70c05" "fileHash": "da5f857e77d3aa59c461efad804116931c059b36e6b4da0b5d9452753ec70c05"
} }
], ],
"da5f857e77d3aa59c461efad804116931c059b36e6b4da0b5d9452753ec70c05/2.png": [ "da5f857e77d3aa59c461efad804116931c059b36e6b4da0b5d9452753ec70c05/2.png": [
@ -34,7 +34,7 @@
"page": 2 "page": 2
}, },
"npub": "npub1x77qywdllzetv9ncnhlfpv62kshlgtt0uqlsq3v22uzzkk2xvvrsn6uyfy", "npub": "npub1x77qywdllzetv9ncnhlfpv62kshlgtt0uqlsq3v22uzzkk2xvvrsn6uyfy",
"pdfFileHash": "da5f857e77d3aa59c461efad804116931c059b36e6b4da0b5d9452753ec70c05" "fileHash": "da5f857e77d3aa59c461efad804116931c059b36e6b4da0b5d9452753ec70c05"
} }
] ]
} }
@ -54,7 +54,7 @@
"page": 1 "page": 1
}, },
"npub": "npub1x77qywdllzetv9ncnhlfpv62kshlgtt0uqlsq3v22uzzkk2xvvrsn6uyfy", "npub": "npub1x77qywdllzetv9ncnhlfpv62kshlgtt0uqlsq3v22uzzkk2xvvrsn6uyfy",
"pdfFileHash": "da5f857e77d3aa59c461efad804116931c059b36e6b4da0b5d9452753ec70c05", "fileHash": "da5f857e77d3aa59c461efad804116931c059b36e6b4da0b5d9452753ec70c05",
"value": "Pera Peric" "value": "Pera Peric"
}, },
{ {
@ -68,7 +68,7 @@
"page": 2 "page": 2
}, },
"npub": "npub1x77qywdllzetv9ncnhlfpv62kshlgtt0uqlsq3v22uzzkk2xvvrsn6uyfy", "npub": "npub1x77qywdllzetv9ncnhlfpv62kshlgtt0uqlsq3v22uzzkk2xvvrsn6uyfy",
"pdfFileHash": "da5f857e77d3aa59c461efad804116931c059b36e6b4da0b5d9452753ec70c05", "fileHash": "da5f857e77d3aa59c461efad804116931c059b36e6b4da0b5d9452753ec70c05",
"value": "Pera Peric" "value": "Pera Peric"
} }
] ]

View File

@ -636,8 +636,8 @@ export const CreatePage = () => {
width: drawnField.width width: drawnField.width
}, },
npub: drawnField.counterpart, npub: drawnField.counterpart,
pdfFileHash: fileHash, fileName: file.name,
fileName: file.name fileHash
} }
}) })
}) || [] }) || []

View File

@ -105,7 +105,7 @@ const SlimPdfView = ({
const m = parsedSignatureEvents[ const m = parsedSignatureEvents[
e as `npub1${string}` e as `npub1${string}`
].parsedContent?.marks.filter( ].parsedContent?.marks.filter(
(m) => m.pdfFileHash == hash && m.location.page == i (m) => m.fileHash == hash && m.location.page == i
) )
if (m) { if (m) {
marks.push(...m) marks.push(...m)

View File

@ -11,7 +11,7 @@ export interface CurrentUserMark {
export interface Mark { export interface Mark {
id: number id: number
npub: string npub: string
pdfFileHash: string fileHash: string
type: MarkType type: MarkType
location: MarkLocation location: MarkLocation
fileName: string fileName: string