Fix auth for 1.0.0: add logout endpoint, fix JWT claims consistency, add session revocation
This commit is contained in:
@@ -132,6 +132,15 @@ func (db *DB) GetSession(ctx context.Context, sessionID uuid.UUID) (*Session, er
|
||||
return &session, nil
|
||||
}
|
||||
|
||||
func (db *DB) RevokeSession(ctx context.Context, sessionID uuid.UUID) error {
|
||||
_, err := db.ExecContext(ctx, `
|
||||
UPDATE sessions
|
||||
SET revoked_at = NOW()
|
||||
WHERE id = $1 AND revoked_at IS NULL
|
||||
`, sessionID)
|
||||
return err
|
||||
}
|
||||
|
||||
func (db *DB) GetUserOrganizations(ctx context.Context, userID uuid.UUID) ([]Organization, error) {
|
||||
rows, err := db.QueryContext(ctx, `
|
||||
SELECT o.id, o.name, o.slug, o.created_at
|
||||
|
||||
Reference in New Issue
Block a user