Skip to content

Commit

Permalink
add support for creator and updater URI in DocumentMeta
Browse files Browse the repository at this point in the history
  • Loading branch information
hugowetterberg committed Mar 6, 2025
1 parent 16e4172 commit 94f890d
Show file tree
Hide file tree
Showing 6 changed files with 17 additions and 2 deletions.
2 changes: 2 additions & 0 deletions repository/docstore.go
Original file line number Diff line number Diff line change
Expand Up @@ -358,7 +358,9 @@ type DeleteRecord struct {

type DocumentMeta struct {
Created time.Time
CreatorURI string
Modified time.Time
UpdaterURI string
CurrentVersion int64
ACL []ACLEntry
Statuses map[string]Status
Expand Down
2 changes: 2 additions & 0 deletions repository/documents_api.go
Original file line number Diff line number Diff line change
Expand Up @@ -1297,7 +1297,9 @@ func (a *DocumentsService) GetMeta(

resp := repository.DocumentMeta{
Created: meta.Created.Format(time.RFC3339),
CreatorUri: meta.CreatorURI,
Modified: meta.Modified.Format(time.RFC3339),
UpdaterUri: meta.UpdaterURI,
CurrentVersion: meta.CurrentVersion,
IsMetaDocument: meta.MainDocument != "",
MainDocument: meta.MainDocument,
Expand Down
6 changes: 6 additions & 0 deletions repository/documents_api_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -646,6 +646,8 @@ func TestDocumentsServiceMetaDocuments(t *testing.T) {
CurrentVersion: 1,
IsMetaDocument: true,
MainDocument: docA.Uuid,
CreatorUri: "user://test/testdocumentsservicemetadocuments",
UpdaterUri: "user://test/testdocumentsservicemetadocuments",
}

ignoreTimeVariantValues := cmpopts.IgnoreMapEntries(
Expand Down Expand Up @@ -962,6 +964,8 @@ func TestIntegrationBulkCrud(t *testing.T) {
},
},
CurrentVersion: 1,
CreatorUri: "user://test/testintegrationbulkcrud",
UpdaterUri: "user://test/testintegrationbulkcrud",
}

cmpDiffA := cmp.Diff(&wantMetaA, metaA.Meta,
Expand Down Expand Up @@ -992,6 +996,8 @@ func TestIntegrationBulkCrud(t *testing.T) {
Creator: testUserURI,
},
},
CreatorUri: "user://test/testintegrationbulkcrud",
UpdaterUri: "user://test/testintegrationbulkcrud",
}

cmpDiffB := cmp.Diff(&wantMetaB, metaB.Meta,
Expand Down
2 changes: 2 additions & 0 deletions repository/pgstore.go
Original file line number Diff line number Diff line change
Expand Up @@ -1283,7 +1283,9 @@ func (s *PGDocStore) GetDocumentMeta(

meta := DocumentMeta{
Created: info.Created.Time,
CreatorURI: info.CreatorUri,
Modified: info.Updated.Time,
UpdaterURI: info.UpdaterUri,
CurrentVersion: info.CurrentVersion,
Statuses: make(map[string]Status),
MainDocument: mainDoc,
Expand Down
4 changes: 3 additions & 1 deletion repository/testdata/TestIntegrationWorkflows/meta.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@
}
],
"workflowState": "draft",
"workflowCheckpoint": "usable"
"workflowCheckpoint": "usable",
"creatorUri": "user://test/testintegrationworkflows",
"updaterUri": "user://test/testintegrationworkflows"
}
}
3 changes: 2 additions & 1 deletion testdata/planning_rows.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@
"StartDate": "2023-09-11",
"EndDate": "2023-09-11",
"Priority": 2,
"Event": null
"Event": null,
"Public": null
},
"Assignments": [
{
Expand Down

0 comments on commit 94f890d

Please sign in to comment.