mirror of
https://github.com/zoriya/Kyoo.git
synced 2026-06-07 23:05:15 -04:00
Implement token refresh for websockets
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
// Code generated by sqlc. DO NOT EDIT.
|
||||
// versions:
|
||||
// sqlc v1.30.0
|
||||
// sqlc v1.31.1
|
||||
// source: sessions.sql
|
||||
|
||||
package dbc
|
||||
@@ -86,6 +86,46 @@ func (q *Queries) DeleteSession(ctx context.Context, arg DeleteSessionParams) (S
|
||||
return i, err
|
||||
}
|
||||
|
||||
const getUserFromSessionId = `-- name: GetUserFromSessionId :one
|
||||
select
|
||||
s.pk,
|
||||
s.id,
|
||||
s.last_used,
|
||||
u.pk, u.id, u.username, u.email, u.password, u.claims, u.created_date, u.last_seen
|
||||
from
|
||||
keibi.users as u
|
||||
inner join keibi.sessions as s on u.pk = s.user_pk
|
||||
where
|
||||
s.id = $1
|
||||
limit 1
|
||||
`
|
||||
|
||||
type GetUserFromSessionIdRow struct {
|
||||
Pk int32 `json:"pk"`
|
||||
Id uuid.UUID `json:"id"`
|
||||
LastUsed time.Time `json:"lastUsed"`
|
||||
User User `json:"user"`
|
||||
}
|
||||
|
||||
func (q *Queries) GetUserFromSessionId(ctx context.Context, id uuid.UUID) (GetUserFromSessionIdRow, error) {
|
||||
row := q.db.QueryRow(ctx, getUserFromSessionId, id)
|
||||
var i GetUserFromSessionIdRow
|
||||
err := row.Scan(
|
||||
&i.Pk,
|
||||
&i.Id,
|
||||
&i.LastUsed,
|
||||
&i.User.Pk,
|
||||
&i.User.Id,
|
||||
&i.User.Username,
|
||||
&i.User.Email,
|
||||
&i.User.Password,
|
||||
&i.User.Claims,
|
||||
&i.User.CreatedDate,
|
||||
&i.User.LastSeen,
|
||||
)
|
||||
return i, err
|
||||
}
|
||||
|
||||
const getUserFromToken = `-- name: GetUserFromToken :one
|
||||
select
|
||||
s.pk,
|
||||
|
||||
Reference in New Issue
Block a user