Skip to content

Conversation

nightnei
Copy link
Contributor

@nightnei nightnei commented Apr 2, 2021

No description provided.

@nightnei nightnei requested a review from StyleT April 2, 2021 09:52
@nightnei nightnei changed the title feat: ILS supports a few domains and routes are filtered per each of them (ILC side) feat: supports a few domains Apr 2, 2021
* Returns new object with routes list for current domain
* and without "supportedDomains" data and property "domainId" inside every "route"
*/
#filterConfigByDomain = (config, domain) => {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we avoid fn params modification & rather create new object?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.


const { domain } = options?.filter || {};
if (domain) {
res.data = this.#filterConfigByDomain(res.data, domain);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pass options?.filter directly to this.#filterConfigByDomain & rename it to this.#filterConfig

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

@StyleT
Copy link
Contributor

StyleT commented Apr 2, 2021

Pls set merge into feature/supportFewDomains_master instead of master

@@ -50,13 +50,18 @@ module.exports = class Registry {
this.#logger.info('Registry preheated successfully!');
}

#getConfig = async () => {
#getConfig = async (options) => {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pls use memoization before filtration

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

@@ -90,6 +91,25 @@ router.get('/', async (req, res) => {
return acc;
}, {});

data.supportedDomains = [
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
data.supportedDomains = [
data.routerDomains = [

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

@nightnei nightnei changed the base branch from master to feature/supportFewDomains_master April 2, 2021 14:39
@nightnei nightnei requested a review from StyleT April 2, 2021 14:43
@@ -19,7 +21,12 @@ function makeAppId(appName, slotName) {
return `${appName.replace('@portal/', '')}__at__${slotName}`;
}

function clone(source) {
Copy link
Contributor

@StyleT StyleT Apr 6, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
function clone(source) {
function cloneObjectDeep(source) {

Copy link
Contributor Author

@nightnei nightnei Apr 8, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

const clonedConfig = clone(config);
const { domain } = filter;

if (domain) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pls inverse condition here to decrease nesting level.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I did it consciously since property filter can contain other filters in the future

@nightnei nightnei requested a review from StyleT April 8, 2021 08:11
@nightnei nightnei merged commit 8948419 into feature/supportFewDomains_master Apr 8, 2021
@nightnei nightnei deleted the feature/supportFewDomains branch April 8, 2021 08:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants