Skip to content

Commit 2cedef5

Browse files
committed
WIP updated updatedTime when modifying providerConnectionRequests
Modifying this commit message to try to re-trigger a failed GitHub action. BACK-4414
1 parent 20c18fe commit 2cedef5

2 files changed

Lines changed: 8 additions & 10 deletions

File tree

patients/repository/repository.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -891,6 +891,7 @@ func (r *repository) AddProviderConnectionRequest(ctx context.Context, clinicId,
891891

892892
key := "providerConnectionRequests." + request.ProviderName
893893
update := bson.M{
894+
"$currentDate": bson.M{"updatedTime": true},
894895
"$push": bson.M{
895896
key: bson.M{
896897
"$each": bson.A{request},

patients/repository/repository_test.go

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1830,22 +1830,17 @@ var _ = Describe("Patients Repository", func() {
18301830
})
18311831

18321832
Describe("Add provider connection request", func() {
1833-
BeforeEach(func() {
1834-
dataSources := patients.DataSources{{
1835-
ProviderName: patients.DexcomDataSourceProviderName,
1836-
State: "pending",
1837-
}}
1838-
err := repo.UpdatePatientDataSources(context.Background(), *randomPatient.UserId, &dataSources)
1839-
Expect(err).ToNot(HaveOccurred())
1840-
})
1841-
18421833
It("correctly adds multiple requests", func() {
18431834
request := patients.ConnectionRequest{
18441835
ProviderName: patients.DexcomDataSourceProviderName,
18451836
CreatedTime: time.Now().Truncate(time.Millisecond),
18461837
}
18471838

1848-
err := repo.AddProviderConnectionRequest(context.Background(), randomPatient.ClinicId.Hex(), *randomPatient.UserId, request)
1839+
patientBefore, err := repo.Get(context.Background(),
1840+
randomPatient.ClinicId.Hex(), *randomPatient.UserId)
1841+
Expect(err).ToNot(HaveOccurred())
1842+
1843+
err = repo.AddProviderConnectionRequest(context.Background(), randomPatient.ClinicId.Hex(), *randomPatient.UserId, request)
18491844
Expect(err).ToNot(HaveOccurred())
18501845

18511846
err = repo.AddProviderConnectionRequest(context.Background(), randomPatient.ClinicId.Hex(), *randomPatient.UserId, request)
@@ -1863,6 +1858,8 @@ var _ = Describe("Patients Repository", func() {
18631858
Expect(dexcom[0].ProviderName).To(BeComparableTo(request.ProviderName))
18641859
Expect(dexcom[1].CreatedTime).To(BeComparableTo(request.CreatedTime))
18651860
Expect(dexcom[1].ProviderName).To(BeComparableTo(request.ProviderName))
1861+
1862+
Expect(patient.UpdatedTime).To(BeTemporally(">", patientBefore.UpdatedTime))
18661863
})
18671864
})
18681865

0 commit comments

Comments
 (0)