Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(core): add account center api #6772

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

wangsijie
Copy link
Contributor

Summary

Add GET/PATCH api of account center, this settings will be used the control the global access of Profile API.

Testing

Integration tests.

Checklist

  • .changeset
  • unit tests
  • integration tests
  • necessary TSDoc comments

Copy link

github-actions bot commented Nov 6, 2024

COMPARE TO master

Total Size Diff 📈 +6.82 KB

Diff by File
Name Diff
packages/core/src/queries/account-center.ts 📈 +1.81 KB
packages/core/src/routes/account-center/index.openapi.json 📈 +1.2 KB
packages/core/src/routes/account-center/index.ts 📈 +1.28 KB
packages/core/src/routes/init.ts 📈 +162 Bytes
packages/core/src/routes/swagger/utils/documents.ts 📈 +76 Bytes
packages/core/src/tenants/Queries.ts 📈 +125 Bytes
packages/integration-tests/src/api/account-center.ts 📈 +487 Bytes
packages/integration-tests/src/tests/api/account-center.test.ts 📈 +776 Bytes
packages/schemas/src/foundations/jsonb-types/account-center.ts 📈 +969 Bytes

@wangsijie wangsijie force-pushed the wangsijie-log-9896-database-table-for-profile-api-control branch from 4cd7e01 to 007de0a Compare November 6, 2024 03:18
Base automatically changed from wangsijie-log-9896-database-table-for-profile-api-control to master November 6, 2024 03:37
@github-actions github-actions bot added size/l and removed size/m labels Nov 6, 2024
@wangsijie wangsijie force-pushed the wangsijie-log-9897-api-control-for-global-and-specific-fields branch from 864ffa8 to cf5f426 Compare November 6, 2024 07:11
@github-actions github-actions bot added size/m and removed size/l labels Nov 6, 2024
@wangsijie wangsijie force-pushed the wangsijie-log-9897-api-control-for-global-and-specific-fields branch from cf5f426 to d8457c8 Compare November 7, 2024 03:41
@wangsijie wangsijie force-pushed the wangsijie-log-9897-api-control-for-global-and-specific-fields branch from d8457c8 to daa82e0 Compare November 7, 2024 09:42
Comment on lines +19 to +25
public readonly insert = buildInsertIntoWithPool(this.pool)(AccountCenters, {
returning: true,
});

public readonly update = buildUpdateWhereWithPool(this.pool)(AccountCenters, true);

public readonly find = buildFindEntityByIdWithPool(this.pool)(AccountCenters);
Copy link
Contributor

Choose a reason for hiding this comment

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

How about extending the SchemaQueries class? No need to redefine these standard query methods.

Comment on lines +12 to +16
const defaultAccountCenter: Omit<AccountCenter, 'tenantId'> = {
id: 'default',
enabled: false,
fields: {},
};
Copy link
Contributor

Choose a reason for hiding this comment

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

Should we put this default value definition under @logto/schemas?
Actually should we seed the default value in DB with a DB alteration?

return accountCenter;
}

await this.insert(defaultAccountCenter);
Copy link
Contributor

Choose a reason for hiding this comment

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

return await this.insert(defaultAccountCenter) will return the inserted value?

Copy link
Contributor

Choose a reason for hiding this comment

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

As commented above, can we follow the default SIE pattern, seed the default values in DB directly? Looks to me this fallback logic is for one-time use only, should not be placed in this query method.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Development

Successfully merging this pull request may close these issues.

2 participants