Skip to content

Commit

Permalink
Fix bugs
Browse files Browse the repository at this point in the history
  • Loading branch information
htysc committed Dec 8, 2023
1 parent 0540346 commit 00e85fd
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 6 deletions.
1 change: 1 addition & 0 deletions backend/models/organization.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ const {GDBQOModel} = require("./ClientFunctionalities/questionOccurrence");
const GDBOrganizationModel = createGraphDBModel({
name: {type: String, internalKey: 'tove_org:hasName'},
address: {type: GDBAddressModel, internalKey: 'ic:hasAddress'},
description: {type: String, internalKey: 'cids:hasDescription'},
characteristicOccurrences: {type: [GDBCOModel],
internalKey: ':hasCharacteristicOccurrence', onDelete: DeleteType.CASCADE},
questionOccurrences: {type: [GDBQOModel],
Expand Down
6 changes: 3 additions & 3 deletions backend/services/partnerNetwork/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ async function fetchOrganization(req, res, next) {
const genericId = provider[providerType]._id;
organizationGeneric = await fetchSingleGenericHelper(providerType, genericId);
} catch (e) {
return res.status(404).json({message: 'Partner organization not found' + (e.message ? ': ' + e.message : null)});
return res.status(404).json({message: 'Partner organization not found' + (e.message ? ': ' + e.message : '')});
}

const organization = await getOrganization(organizationGeneric);
Expand Down Expand Up @@ -186,8 +186,8 @@ async function updateOrganization(req, res, next) {
await initPredefinedCharacteristics();
}
console.log(JSON.stringify(PredefinedCharacteristics));
organization.fields[PredefinedCharacteristics['Organization Name']._uri.split('#')[1]] = partnerData.organization.name;
organization.fields[PredefinedCharacteristics['Description']._uri.split('#')[1]] = partnerData.organization.description;
organization.fields[PredefinedCharacteristics['Organization Name']._uri.split('#')[1]] = partnerData.organization.name || '';
organization.fields[PredefinedCharacteristics['Description']._uri.split('#')[1]] = partnerData.organization.description || '';
// organization.fields[PredefinedCharacteristics['Address']._uri.split('#')[1]] = partnerData.organization.address; // TODO
organization.formId = organizationFormId;
console.log(organization);
Expand Down
6 changes: 3 additions & 3 deletions backend/services/partnerNetwork/referrals.js
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ async function sendReferral(req, res, next) {
try {
referralGeneric = await fetchSingleGenericHelper('referral', id);
} catch (e) {
return res.status(404).json({message: 'Referral not found' + (e.message ? ': ' + e.message : null)});
return res.status(404).json({message: 'Referral not found' + (e.message ? ': ' + e.message : '')});
}
} else {
return res.status(400).json({message: 'No id provided'});
Expand All @@ -85,7 +85,7 @@ async function sendReferral(req, res, next) {
return res.status(200).json({success: true, message: 'Receiving service provider is not a partner organization'});
}
} catch (e) {
return res.status(404).json({message: 'Receiving organization not found' + (e.message ? ': ' + e.message : null)});
return res.status(404).json({message: 'Receiving organization not found' + (e.message ? ': ' + e.message : '')});
}

const referral = await populateReferral(referralGeneric, receiverId);
Expand All @@ -109,7 +109,7 @@ async function sendReferral(req, res, next) {
clearTimeout(timeout);

if (response.status >= 400 && response.status < 600) {
return res.status(response.status).json({message: 'Bad response from receiver: ' + response.status + (response.message ? ': ' + response.message : null)});
return res.status(response.status).json({message: 'Bad response from receiver: ' + response.status + (response.message ? ': ' + response.message : '')});
}
return res.status(202).json({success: true, message: `Successfully created and sent a referral`});
} catch (e) {
Expand Down

0 comments on commit 00e85fd

Please sign in to comment.