Skip to content

Feat prefs improvement - #2486

Merged
TorstenDittmann merged 16 commits into
feat-database-indexingfrom
feat-prefs-improvement
Jan 4, 2022
Merged

TorstenDittmann merged 16 commits into
feat-database-indexingfrom
feat-prefs-improvement

Conversation

@Meldiron

@Meldiron Meldiron commented Dec 13, 2021 •

Copy link
Copy Markdown
Contributor

What does this PR do?

  • Updates docs to reflect current behaviour
  • Add API level size validation (so DB does not have to throw an error on too long prefs)

The maximum allowed size is 65535, which is 64kB.

Opened question

  • I decided not to work on Teams prefs API, because it would mean a lot of copy&paste. If we agree on new endpoints as suggested by Eldad, we can define a new API group (personalizations) that will be able to handle both users&teams in one endpoint

Test Plan

Added new test

Related PRs and Issues

utopia-php/http#40

Have you read the Contributing Guidelines on issues?

✅

@Meldiron
Meldiron changed the base branch from master to feat-database-indexing December 13, 2021 13:10
Comment thread composer.json Resolved

@kodumbeats kodumbeats left a comment •

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.

I think the root of this problem is the size of this field in app/config/collections.php and can't be solved in the route:

edit: this may be solved as simply as changing the length of this field in app/config/collections.php to 16384 - 1 = 16383

Comment thread app/controllers/api/users.php Outdated
/** @var Utopia\Database\Database $dbForInternal */
/** @var Appwrite\Stats\Stats $usage */

if(\strlen($prefs) > 16384) {

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.

This limit should be a part of a validator for better consistency. We also discussed mentioning the size limit as part of the param description. I think the extension can be located at src/Appwrite/Auth/Validator/Prefs unless someone has a better idea.

Note: when adding a new param we need to make sure it is translated to the proper format for the Swagger / OpenAPI exports.

@Meldiron

Copy link
Copy Markdown
Contributor Author

To get tests to pass, we need this merged and released: #2486

I could not use the repositories trick, some other libraries did not like the version as branch number instead of a number.

utopia-php/database[0.12.0, ..., 0.12.1] require utopia-php/framework 0.*.* -> found utopia-php/framework[0.1.0, ..., 0.19.3] but it conflicts with your root composer.json require (dev-fix-improve-validators).

@TorstenDittmann
TorstenDittmann merged commit b2b4c61 into feat-database-indexing Jan 4, 2022
@TorstenDittmann
TorstenDittmann deleted the feat-prefs-improvement branch January 4, 2022 16:01
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.

4 participants