-
Notifications
You must be signed in to change notification settings - Fork 100
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Convert summary in document model to a pointer so we can delete the value * Add method and path to successful patch log lines * Add document file revisions to data model * Use assert.ElementsMatch instead of reflect.DeepEqual so order is ignored for slices * Add server package * Add API v2 * Enable using v2 of the API from the frontend via the 'api_v2' feature flag * Use api_version from the config service * Add api_version for new fetch call * Add api_version for another fetch
- Loading branch information
Showing
46 changed files
with
7,608 additions
and
143 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -90,6 +90,14 @@ email { | |
from_address = "[email protected]" | ||
} | ||
|
||
// FeatureFlags contain available feature flags. | ||
feature_flags { | ||
// api_v2 enables v2 of the API. | ||
flag "api_v2" { | ||
enabled = false | ||
} | ||
} | ||
|
||
// google_workspace configures Hermes to work with Google Workspace. | ||
google_workspace { | ||
// create_doc_shortcuts enables creating a shortcut in the shortcuts_folder | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -138,6 +138,10 @@ func TestCompareAlgoliaAndDatabaseDocument(t *testing.T) { | |
"createdTime": float64(time.Date( | ||
2023, time.April, 5, 1, 0, 0, 0, time.UTC).Unix()), | ||
"currentVersion": "1.2.3", | ||
"fileRevisions": map[string]any{ | ||
"1": "FileRevision1", | ||
"2": "FileRevision2", | ||
}, | ||
"modifiedTime": float64(time.Date( | ||
2023, time.April, 5, 23, 0, 0, 0, time.UTC).Unix()), | ||
"owners": []any{ | ||
|
@@ -204,10 +208,20 @@ func TestCompareAlgoliaAndDatabaseDocument(t *testing.T) { | |
2023, time.April, 5, 1, 0, 0, 0, time.UTC), | ||
DocumentModifiedAt: time.Date( | ||
2023, time.April, 5, 23, 0, 0, 0, time.UTC), | ||
FileRevisions: []models.DocumentFileRevision{ | ||
{ | ||
GoogleDriveFileRevisionID: "1", | ||
Name: "FileRevision1", | ||
}, | ||
{ | ||
GoogleDriveFileRevisionID: "2", | ||
Name: "FileRevision2", | ||
}, | ||
}, | ||
Owner: &models.User{ | ||
EmailAddress: "[email protected]", | ||
}, | ||
Summary: "Summary1", | ||
Summary: &[]string{"Summary1"}[0], | ||
Status: models.InReviewDocumentStatus, | ||
}, | ||
dbDocReviews: models.DocumentReviews{ | ||
|
@@ -270,6 +284,124 @@ func TestCompareAlgoliaAndDatabaseDocument(t *testing.T) { | |
}, | ||
}, | ||
|
||
"good with different order of slice and map fields": { | ||
algoDoc: map[string]any{ | ||
"appCreated": true, | ||
"approvedBy": []any{ | ||
"[email protected]", | ||
"[email protected]", | ||
}, | ||
"approvers": []any{ | ||
"[email protected]", | ||
"[email protected]", | ||
}, | ||
"changesRequestedBy": []any{ | ||
"[email protected]", | ||
"[email protected]", | ||
}, | ||
"contributors": []any{ | ||
"[email protected]", | ||
"[email protected]", | ||
}, | ||
"createdTime": float64(time.Date( | ||
2023, time.April, 5, 1, 0, 0, 0, time.UTC).Unix()), | ||
"docNumber": "ABC-123", | ||
"docType": "RFC", | ||
"fileRevisions": map[string]any{ | ||
"2": "FileRevision2", | ||
"1": "FileRevision1", | ||
}, | ||
"modifiedTime": float64(time.Date( | ||
2023, time.April, 5, 23, 0, 0, 0, time.UTC).Unix()), | ||
"owners": []any{"[email protected]"}, | ||
"product": "Product1", | ||
"stakeholders": []any{ | ||
"[email protected]", | ||
"[email protected]", | ||
}, | ||
}, | ||
dbDoc: models.Document{ | ||
DocumentNumber: 123, | ||
DocumentType: models.DocumentType{ | ||
Name: "RFC", | ||
}, | ||
Product: models.Product{ | ||
Name: "Product1", | ||
Abbreviation: "ABC", | ||
}, | ||
Approvers: []*models.User{ | ||
{ | ||
EmailAddress: "[email protected]", | ||
}, | ||
{ | ||
EmailAddress: "[email protected]", | ||
}, | ||
}, | ||
Contributors: []*models.User{ | ||
{ | ||
EmailAddress: "[email protected]", | ||
}, | ||
{ | ||
EmailAddress: "[email protected]", | ||
}, | ||
}, | ||
CustomFields: []*models.DocumentCustomField{ | ||
{ | ||
DocumentTypeCustomField: models.DocumentTypeCustomField{ | ||
Name: "Stakeholders", | ||
DocumentType: models.DocumentType{ | ||
Name: "RFC", | ||
}, | ||
}, | ||
Value: `["[email protected]","[email protected]"]`, | ||
}, | ||
}, | ||
DocumentCreatedAt: time.Date( | ||
2023, time.April, 5, 1, 0, 0, 0, time.UTC), | ||
DocumentModifiedAt: time.Date( | ||
2023, time.April, 5, 23, 0, 0, 0, time.UTC), | ||
FileRevisions: []models.DocumentFileRevision{ | ||
{ | ||
GoogleDriveFileRevisionID: "1", | ||
Name: "FileRevision1", | ||
}, | ||
{ | ||
GoogleDriveFileRevisionID: "2", | ||
Name: "FileRevision2", | ||
}, | ||
}, | ||
Owner: &models.User{ | ||
EmailAddress: "[email protected]", | ||
}, | ||
}, | ||
dbDocReviews: models.DocumentReviews{ | ||
{ | ||
Status: models.ApprovedDocumentReviewStatus, | ||
User: models.User{ | ||
EmailAddress: "[email protected]", | ||
}, | ||
}, | ||
{ | ||
Status: models.ApprovedDocumentReviewStatus, | ||
User: models.User{ | ||
EmailAddress: "[email protected]", | ||
}, | ||
}, | ||
{ | ||
Status: models.ChangesRequestedDocumentReviewStatus, | ||
User: models.User{ | ||
EmailAddress: "[email protected]", | ||
}, | ||
}, | ||
{ | ||
Status: models.ChangesRequestedDocumentReviewStatus, | ||
User: models.User{ | ||
EmailAddress: "[email protected]", | ||
}, | ||
}, | ||
}, | ||
}, | ||
|
||
"bad objectID": { | ||
algoDoc: map[string]any{ | ||
"objectID": "GoogleFileID1", | ||
|
@@ -839,7 +971,7 @@ func TestCompareAlgoliaAndDatabaseDocument(t *testing.T) { | |
Owner: &models.User{ | ||
EmailAddress: "[email protected]", | ||
}, | ||
Summary: "BadSummary1", | ||
Summary: &[]string{"BadSummary1"}[0], | ||
}, | ||
shouldErr: true, | ||
errContains: "summary not equal", | ||
|
Oops, something went wrong.