mirror of
https://github.com/paperless-ngx/paperless-ngx.git
synced 2026-09-18 07:37:58 +00:00
Make content follow the version
- store content per version - root doc retrieval returns latest content - updating content affects the latest version - load metadata per version
This commit is contained in:
@@ -165,6 +165,14 @@ describe(`DocumentService`, () => {
|
||||
expect(req.request.method).toEqual('GET')
|
||||
})
|
||||
|
||||
it('should call appropriate api endpoint for versioned metadata', () => {
|
||||
subscription = service.getMetadata(documents[0].id, 123).subscribe()
|
||||
const req = httpTestingController.expectOne(
|
||||
`${environment.apiBaseUrl}${endpoint}/${documents[0].id}/metadata/?version=123`
|
||||
)
|
||||
expect(req.request.method).toEqual('GET')
|
||||
})
|
||||
|
||||
it('should call appropriate api endpoint for getting selection data', () => {
|
||||
const ids = [documents[0].id]
|
||||
subscription = service.getSelectionData(ids).subscribe()
|
||||
|
||||
@@ -242,8 +242,15 @@ export class DocumentService extends AbstractPaperlessService<Document> {
|
||||
)
|
||||
}
|
||||
|
||||
getMetadata(id: number): Observable<DocumentMetadata> {
|
||||
return this.http.get<DocumentMetadata>(this.getResourceUrl(id, 'metadata'))
|
||||
getMetadata(
|
||||
id: number,
|
||||
versionID: number = null
|
||||
): Observable<DocumentMetadata> {
|
||||
let url = new URL(this.getResourceUrl(id, 'metadata'))
|
||||
if (versionID) {
|
||||
url.searchParams.append('version', versionID.toString())
|
||||
}
|
||||
return this.http.get<DocumentMetadata>(url.toString())
|
||||
}
|
||||
|
||||
bulkEdit(ids: number[], method: string, args: any) {
|
||||
|
||||
Reference in New Issue
Block a user