added admin options
This commit is contained in:
@@ -13,7 +13,7 @@ import (
|
||||
const createUser = `-- name: CreateUser :one
|
||||
INSERT INTO users (email, ory_identity_id)
|
||||
VALUES ($1, $2)
|
||||
RETURNING id, email, created_at, ory_identity_id
|
||||
RETURNING id, email, created_at, ory_identity_id, is_admin
|
||||
`
|
||||
|
||||
type CreateUserParams struct {
|
||||
@@ -29,12 +29,13 @@ func (q *Queries) CreateUser(ctx context.Context, arg CreateUserParams) (User, e
|
||||
&i.Email,
|
||||
&i.CreatedAt,
|
||||
&i.OryIdentityID,
|
||||
&i.IsAdmin,
|
||||
)
|
||||
return i, err
|
||||
}
|
||||
|
||||
const getUserByEmail = `-- name: GetUserByEmail :one
|
||||
SELECT id, email, created_at, ory_identity_id FROM users WHERE email = $1 LIMIT 1
|
||||
SELECT id, email, created_at, ory_identity_id, is_admin FROM users WHERE email = $1 LIMIT 1
|
||||
`
|
||||
|
||||
func (q *Queries) GetUserByEmail(ctx context.Context, email string) (User, error) {
|
||||
@@ -45,12 +46,13 @@ func (q *Queries) GetUserByEmail(ctx context.Context, email string) (User, error
|
||||
&i.Email,
|
||||
&i.CreatedAt,
|
||||
&i.OryIdentityID,
|
||||
&i.IsAdmin,
|
||||
)
|
||||
return i, err
|
||||
}
|
||||
|
||||
const getUserByOryID = `-- name: GetUserByOryID :one
|
||||
SELECT id, email, created_at, ory_identity_id FROM users WHERE ory_identity_id = $1 LIMIT 1
|
||||
SELECT id, email, created_at, ory_identity_id, is_admin FROM users WHERE ory_identity_id = $1 LIMIT 1
|
||||
`
|
||||
|
||||
func (q *Queries) GetUserByOryID(ctx context.Context, oryIdentityID sql.NullString) (User, error) {
|
||||
@@ -61,6 +63,7 @@ func (q *Queries) GetUserByOryID(ctx context.Context, oryIdentityID sql.NullStri
|
||||
&i.Email,
|
||||
&i.CreatedAt,
|
||||
&i.OryIdentityID,
|
||||
&i.IsAdmin,
|
||||
)
|
||||
return i, err
|
||||
}
|
||||
@@ -69,7 +72,7 @@ const updateUserOryID = `-- name: UpdateUserOryID :one
|
||||
UPDATE users
|
||||
SET ory_identity_id = $1
|
||||
WHERE email = $2
|
||||
RETURNING id, email, created_at, ory_identity_id
|
||||
RETURNING id, email, created_at, ory_identity_id, is_admin
|
||||
`
|
||||
|
||||
type UpdateUserOryIDParams struct {
|
||||
@@ -85,6 +88,7 @@ func (q *Queries) UpdateUserOryID(ctx context.Context, arg UpdateUserOryIDParams
|
||||
&i.Email,
|
||||
&i.CreatedAt,
|
||||
&i.OryIdentityID,
|
||||
&i.IsAdmin,
|
||||
)
|
||||
return i, err
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user