Skip to content

Commit

Permalink
fix: update api version
Browse files Browse the repository at this point in the history
  • Loading branch information
MaxSchaefer committed Sep 20, 2024
1 parent 5e8c089 commit e0957a8
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 15 deletions.
26 changes: 16 additions & 10 deletions api-services/mutations/properties/property_value_mutations.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@ import { useMutation, useQuery, useQueryClient } from '@tanstack/react-query'
import {
AttachPropertyValueRequest,
GetAttachedPropertyValuesRequest,
TaskPropertyMatcher
TaskPropertyMatcher,
PatientPropertyMatcher
} from '@helpwave/proto-ts/services/property_svc/v1/property_value_svc_pb'
import {
Date as ProtoDate
Expand All @@ -20,21 +21,26 @@ export const usePropertyWithValueListQuery = (subjectId: string | undefined, sub
queryKey: [QueryKeys.properties, QueryKeys.attachedProperties, subjectId],
enabled: !!subjectId,
queryFn: async () => {
console.log('usePropertyWithValueListQuery', subjectId, subjectType)
if (!subjectId) {
return undefined
}
const req = new GetAttachedPropertyValuesRequest()

const taskMatcher = new TaskPropertyMatcher()
if (subjectType === 'task') {
taskMatcher.setTaskId(subjectId)
if (wardId) {
taskMatcher.setWardId(wardId)
}
}
req.setTaskMatcher(taskMatcher)
const patientMatcher = new PatientPropertyMatcher()

if (subjectType === 'patient') {
console.warn("PropertyWithValueListQuery: subjectType patient isn't supported in production yet.")
switch (subjectType) {
case 'task':
taskMatcher.setTaskId(subjectId)
if (wardId) taskMatcher.setWardId(wardId)
req.setTaskMatcher(taskMatcher)
break
case 'patient':
patientMatcher.setPatientId(subjectId)
if (wardId) patientMatcher.setWardId(wardId)
req.setPatientMatcher(patientMatcher)
break
}

const res = await APIServices.propertyValues.getAttachedPropertyValues(req, getAuthenticatedGrpcMetadata())
Expand Down
2 changes: 1 addition & 1 deletion api-services/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
},
"dependencies": {
"@helpwave/common": "workspace:*",
"@helpwave/proto-ts": "0.44.0-94c8472.0",
"@helpwave/proto-ts": "0.51.0-6a406b8.0",
"@tanstack/react-query": "4.36.1",
"@tanstack/react-query-devtools": "5.35.5",
"@types/google-protobuf": "3.15.12",
Expand Down
8 changes: 4 additions & 4 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit e0957a8

Please sign in to comment.