MCPcopy Create free account
hub / github.com/OpenSIST/OpenSIST.github.io / deleteRecord

Function deleteRecord

src/Data/RecordData.js:124–148  ·  view source on GitHub ↗
(recordId)

Source from the content-addressed store, hash-verified

122}
123
124export async function deleteRecord(recordId) {
125 await updateCachedRecords((records) => {
126 const updatedRecords = {...records};
127 delete updatedRecords[recordId];
128 return updatedRecords;
129 });
130
131 const [applicantID, programID] = recordId.split('|');
132
133 const applicant = await getApplicant(applicantID);
134 const Programs = Object.fromEntries(
135 Object.entries(applicant.Programs).filter(([key]) => key !== programID)
136 );
137 await setApplicant({
138 ...applicant,
139 Programs,
140 Final: applicant.Final === programID ? "" : applicant.Final,
141 });
142
143 const program = await getProgram(programID);
144 await setProgram({
145 ...program,
146 Applicants: program.Applicants.filter(applicant => applicant !== applicantID),
147 });
148}

Callers 2

removeApplicantFunction · 0.90
removeRecordFunction · 0.85

Calls 5

getApplicantFunction · 0.90
setApplicantFunction · 0.90
getProgramFunction · 0.90
setProgramFunction · 0.90
updateCachedRecordsFunction · 0.85

Tested by

no test coverage detected