Skip to content

Commit

Permalink
chore: type > kind
Browse files Browse the repository at this point in the history
  • Loading branch information
davlgd committed Jan 10, 2025
1 parent 653008d commit 0c9ae96
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
4 changes: 2 additions & 2 deletions src/models/ng-ressources.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ export async function linkMember (ngIdOrLabel, ressourceId, org, label) {
id: member.id,
label: label || member.id,
domainName: member.domainName,
type: member.type,
kind: member.kind,
};

Logger.info(`Linking member ${member.id} to Network Group ${found.item.id}`);
Expand Down Expand Up @@ -61,7 +61,7 @@ export async function createExternalPeerWithParent (ngIdOrLabel, label, publicKe
id: `external_${uuidv4()}`,
label: `Parent of ${label}`,
domainName: `${label}.m.${found.item.id}.${NG.DOMAIN}`,
type: 'external',
kind: 'EXTERNAL',
};

Logger.info(`Creating a parent member ${parentMember.id} linked to Network Group ${found.item.id}`);
Expand Down
14 changes: 7 additions & 7 deletions src/models/ng.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,15 @@ export const TIMEOUT = 5000;
export const INTERVAL = 500;
export const DOMAIN = 'ng-cc.cloud';
export const TYPE_PREFIXES = {
app_: 'application',
addon_: 'addon',
external_: 'external',
app_: 'APPLICATION',
addon_: 'ADDON',
external_: 'EXTERNAL',
};

/**
* Construct members from members_ids
* @param {Array<string>} members_ids
* @returns {Array<Object>} Array of members with id, domainName and type
* @returns {Array<Object>} Array of members with id, domainName and kind
*/
export function constructMembers (ngId, membersIds) {
return membersIds.map((id) => {
Expand All @@ -29,9 +29,9 @@ export function constructMembers (ngId, membersIds) {
return {
id,
domainName,
// Get type from prefix match in id (app_*, addon_*, external_*) or default to 'application'
type: prefixToType[Object.keys(prefixToType).find((p) => id.startsWith(p))]
|| 'application',
// Get kind from prefix match in id (app_*, addon_*, external_*) or default to 'APPLICATION'
kind: prefixToType[Object.keys(prefixToType).find((p) => id.startsWith(p))]
|| TYPE_PREFIXES.app_,
};
});
}
Expand Down

0 comments on commit 0c9ae96

Please sign in to comment.