Skip to content

refactor(users-buckets): migrate users and bucket models#211

Merged
apsantiso merged 2 commits intomasterfrom
refactor/migrate-users-and-bucket-models
Apr 8, 2026
Merged

refactor(users-buckets): migrate users and bucket models#211
apsantiso merged 2 commits intomasterfrom
refactor/migrate-users-and-bucket-models

Conversation

@apsantiso
Copy link
Copy Markdown

@apsantiso apsantiso commented Apr 7, 2026

The strategy is to migrate the models gradually, the connection initialization is a bit weird and coupled to how Storj and the models expect it so I had to migrate the class they use to bound all the models and the connection.

Changes

@apsantiso apsantiso force-pushed the refactor/migrate-users-and-bucket-models branch from 028bda3 to d303bb7 Compare April 7, 2026 08:58
@apsantiso apsantiso force-pushed the refactor/remove-service-middleware-dependency branch from ae79332 to e7ce7f6 Compare April 7, 2026 08:58
Base automatically changed from refactor/remove-service-middleware-dependency to master April 7, 2026 10:27
Comment on lines +76 to +89
Database.prototype._createBoundModels = function () {
const bound = {};

const allModels = {
...Database.externalModels,
...Database.localModels,
};

for (const model in allModels) {
bound[model] = allModels[model](this.connection);
}

return bound;
};
Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

The models initialize their connection in the external library so I copied the same file to this repository to initialize the connection for external and local models instead of using https://github.com/internxt/service-storage-models/blob/master/index.js

@apsantiso apsantiso changed the title refactor(users-buckets): remove users and bucket model external depen… refactor(users-buckets): migrate users and bucket models Apr 7, 2026
return createdUser
type Args = { storage?: any; user: TestUser };

const createdUsers: User[] = [];
Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

The e2e seeder broke due to the migration to promises

@apsantiso apsantiso force-pushed the refactor/migrate-users-and-bucket-models branch from d303bb7 to ebb352d Compare April 7, 2026 17:04
@apsantiso apsantiso marked this pull request as ready for review April 8, 2026 07:24
@apsantiso apsantiso requested a review from sg-gs as a code owner April 8, 2026 07:24
@apsantiso apsantiso self-assigned this Apr 8, 2026
const user = await User.create({
email: req.body.email,
password: req.body.password,
maxSpaceBytes: 1024 * 1024 * 1024 * 2,
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 should be 1, not 2GB

@apsantiso apsantiso requested a review from sg-gs April 8, 2026 11:04
@apsantiso apsantiso merged commit 3395e74 into master Apr 8, 2026
6 of 7 checks passed
@apsantiso apsantiso deleted the refactor/migrate-users-and-bucket-models branch April 8, 2026 13:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants