Skip to content

Refactor collections config - #5622

Closed
lohanidamodar wants to merge 6 commits into
mainfrom
refactor-collections-config
Closed

lohanidamodar wants to merge 6 commits into
mainfrom
refactor-collections-config

Conversation

@lohanidamodar

@lohanidamodar lohanidamodar commented Jun 1, 2023 •

Copy link
Copy Markdown
Member

What does this PR do?

  • Update collections config into sections so that we can create only relevant collections for console and each projects separately. This will help extend console only collection easily and also improve performance while creating new projects.

Test Plan

(Write your test plan here. If you changed any code, please provide us with clear instructions on how you verified your changes work. Screenshots may also be helpful.)

Related PRs and Issues

  • (Related PR or issue)

Checklist

  • Have you read the Contributing Guidelines on issues?
  • If the PR includes a change to an API's metadata (desc, label, params, etc.), does it also include updated API specs and example docs?

@lohanidamodar
lohanidamodar marked this pull request as ready for review June 1, 2023 05:25
@@ -3591,6 +3603,13 @@
],
],
],
], $commonCollections);

$collections = [

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I was thinking, maybe it will be easier to read if we just add a property to each collection stating where it should go.

@lohanidamodar lohanidamodar Jun 7, 2023 •

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

That is some limitations, and was already using it for those collections that are not common like files and collections

  1. usually many collections go to both console and Project database
  2. it will not allow us to easily extend a collection common in both project and console easily so that we add new attributes in Console only , which was one of the reason for this refactor

public function __construct(string $collection, array $allowedAttributes)
{
$collection = Config::getParam('collections', [])[$collection];
$config = Config::getParam('collections', []);

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

What exactly are we validating here?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Query allowed attributes, validating the attribute is valid in the collection structure.

@lohanidamodar
lohanidamodar requested a review from eldadfux June 7, 2023 23:56
Comment thread app/config/collections.php Outdated
],
],

'realtime' => [

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

realtime is not a common collection. It's only used in the context of console DB

@lohanidamodar

Copy link
Copy Markdown
Member Author

This change is already in main, no sure why there's this PR as well, I don't remember.

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.

3 participants