Skip to content
This repository was archived by the owner on Aug 30, 2025. It is now read-only.

Commit 142256e

Browse files
committed
associating api key with user record
1 parent 3066587 commit 142256e

File tree

6 files changed

+71
-19
lines changed

6 files changed

+71
-19
lines changed

backend/gen/go/db/api-keys.sql.go

Lines changed: 10 additions & 5 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

backend/gen/go/db/models.go

Lines changed: 2 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

backend/gen/go/db/users.sql.go

Lines changed: 42 additions & 12 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

backend/internal/authmw/auth.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,14 +23,14 @@ func New(
2323
}
2424

2525
func (n *AuthMiddleware) ValidateAndInjectAll(ctx context.Context, header http.Header) (context.Context, error) {
26-
ctx, err := n.ValidateAndInjectToken(ctx, header)
26+
ctx, err := n.ValidateAndInjectJwtToken(ctx, header)
2727
if err != nil {
2828
return nil, err
2929
}
3030
return ctx, nil
3131
}
3232

33-
func (n *AuthMiddleware) ValidateAndInjectToken(ctx context.Context, header http.Header) (context.Context, error) {
33+
func (n *AuthMiddleware) ValidateAndInjectJwtToken(ctx context.Context, header http.Header) (context.Context, error) {
3434
ctx, err := n.jwtClient.InjectTokenCtx(ctx, header)
3535
if err != nil {
3636
return nil, err
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
ALTER TABLE neosync_api.users
2+
DROP COLUMN user_type;
3+
4+
-- ALTER TABLE neosync_api.account_api_keys
5+
-- DROP CONSTRAINT IF EXISTS fk_account_api_keys_user_id_users_id;
6+
ALTER TABLE neosync_api.account_api_keys
7+
DROP COLUMN user_id;
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
ALTER TABLE neosync_api.users
2+
ADD COLUMN user_type smallint not null default 0;
3+
4+
ALTER TABLE neosync_api.account_api_keys
5+
ADD COLUMN user_id uuid null;
6+
7+
ALTER TABLE neosync_api.account_api_keys
8+
ADD CONSTRAINT fk_account_api_keys_user_id_users_id FOREIGN KEY (user_id) REFERENCES neosync_api.users(id);

0 commit comments

Comments
 (0)