-
Notifications
You must be signed in to change notification settings - Fork 552
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Refactor questionnaire API routes and update components to use new st…
…ructure - Moved questionnaire routes from the api.tsx file to a new questionnaireApi module for better organization and maintainability. - Updated components (QuestionnaireList, QuestionnaireForm, QuestionnaireSearch, and QuestionnaireShow) to utilize the new questionnaireApi for API calls, ensuring consistency across the application. - Removed deprecated questionnaire routes from the previous API structure.
- Loading branch information
Showing
6 changed files
with
83 additions
and
68 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
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
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 |
---|---|---|
@@ -0,0 +1,75 @@ | ||
import { HttpMethod, Type } from "@/Utils/request/api"; | ||
import { PaginatedResponse } from "@/Utils/request/types"; | ||
|
||
import { Organization } from "../organization/organization"; | ||
import { QuestionnaireDetail } from "./questionnaire"; | ||
|
||
export default { | ||
list: { | ||
path: "/api/v1/questionnaire/", | ||
method: HttpMethod.GET, | ||
TRes: Type<PaginatedResponse<QuestionnaireDetail>>(), | ||
}, | ||
|
||
detail: { | ||
path: "/api/v1/questionnaire/{id}/", | ||
method: HttpMethod.GET, | ||
TRes: Type<QuestionnaireDetail>(), | ||
}, | ||
|
||
create: { | ||
path: "/api/v1/questionnaire/", | ||
method: HttpMethod.POST, | ||
TRes: Type<QuestionnaireDetail>(), | ||
TBody: Type<Partial<QuestionnaireDetail>>(), | ||
}, | ||
|
||
update: { | ||
path: "/api/v1/questionnaire/{id}/", | ||
method: HttpMethod.PUT, | ||
TRes: Type<QuestionnaireDetail>(), | ||
TBody: Type<QuestionnaireDetail>(), | ||
}, | ||
|
||
partialUpdate: { | ||
path: "/api/v1/questionnaire/{id}/", | ||
method: HttpMethod.PATCH, | ||
TRes: Type<QuestionnaireDetail>(), | ||
TBody: Type<Partial<QuestionnaireDetail>>(), | ||
}, | ||
|
||
delete: { | ||
path: "/api/v1/questionnaire/{id}/", | ||
method: HttpMethod.DELETE, | ||
TRes: Type<Record<string, never>>(), | ||
}, | ||
|
||
submit: { | ||
path: "/api/v1/questionnaire/{id}/submit/", | ||
method: HttpMethod.POST, | ||
TRes: Type<Record<string, never>>(), | ||
TBody: Type<{ | ||
resource_id: string; | ||
encounter?: string; | ||
patient: string; | ||
responses: Array<{ | ||
question_id: string; | ||
value: string | number | boolean; | ||
note?: string; | ||
bodysite?: string; | ||
method?: string; | ||
}>; | ||
}>(), | ||
}, | ||
getOrganizations: { | ||
path: "/api/v1/questionnaire/{id}/get_organizations/", | ||
method: HttpMethod.GET, | ||
TRes: Type<PaginatedResponse<Organization>>(), | ||
}, | ||
setOrganizations: { | ||
path: "/api/v1/questionnaire/{id}/set_organizations/", | ||
method: HttpMethod.POST, | ||
TRes: Type<PaginatedResponse<Organization>>(), | ||
TBody: {} as { organization: string[] }, | ||
}, | ||
}; |