Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: [DHIS2-17613] Use new note endpoint #3908

Merged
merged 9 commits into from
Jan 12, 2025
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,11 @@ export const batchActionTypes = {
export const requestAddNoteForEnrollment = (enrollmentId: string, note: string) =>
actionCreator(actionTypes.REQUEST_ADD_NOTE_FOR_ENROLLMENT)({ enrollmentId, note });

export const startAddNoteForEnrollment = (enrollmentId: string, serverData: Object, selections: Object, context: Object) =>
export const startAddNoteForEnrollment = (enrollmentUid: string, serverData: Object, selections: Object, context: Object) =>
actionCreator(actionTypes.START_ADD_NOTE_FOR_ENROLLMENT)({ selections, context }, {
offline: {
effect: {
url: `enrollments/${enrollmentId}/note`,
url: `tracker/enrollments/${enrollmentUid}/note`,
method: effectMethods.POST,
data: serverData,
},
Expand All @@ -31,5 +31,5 @@ export const startAddNoteForEnrollment = (enrollmentId: string, serverData: Obje
},
});

export const addEnrollmentNote = (enrollmentId: string, note: Object) =>
actionCreator(actionTypes.ADD_ENROLLMENT_NOTE)({ enrollmentId, note });
export const addEnrollmentNote = (enrollmentUid: string, note: Object) =>
actionCreator(actionTypes.ADD_ENROLLMENT_NOTE)({ enrollmentUid, note });
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ export const addNoteForEnrollmentEpic = (action$: InputObservable, store: ReduxS
const clientId = uuid();

const serverData = {
notes: [{ value: note }],
value: note,
};

const clientNote = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,11 @@ export const batchActionTypes = {
export const requestAddNoteForEvent = (itemId: string, dataEntryId: string, note: string) =>
actionCreator(actionTypes.REQUEST_ADD_NOTE_FOR_EVENT)({ itemId, dataEntryId, note });

export const startAddNoteForEvent = (eventId: string, serverData: Object, selections: Object, context: Object) =>
export const startAddNoteForEvent = (eventUid: string, serverData: Object, selections: Object, context: Object) =>
actionCreator(actionTypes.START_ADD_NOTE_FOR_EVENT)({ selections, context }, {
offline: {
effect: {
url: `events/${eventId}/note`,
url: `/tracker/events/${eventUid}/note`,
method: effectMethods.POST,
data: serverData,
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ export const addNoteForEventEpic = (action$: InputObservable, store: ReduxStore,

const serverData = {
event: eventId,
notes: [{ value: payload.note }],
value: payload.note,
};

const clientNote = {
Expand Down
Loading