feat(auth): support multiple user roles in JWT and services

- Change JWT access token RoleID claim from int to []int to support multiple roles per user
- Update all token generation and refresh logic to handle multiple role IDs as []int
- Refactor services to return and process multiple role IDs from user_roles table
- Fix OAuth state handling explanation and improve code comments
- Clean up related function signatures and usages for consistency
This commit is contained in:
2026-02-03 16:35:08 +08:00
parent f4b8651a5c
commit fee314870d
5 changed files with 48 additions and 65 deletions
+2 -2
View File
@@ -29,9 +29,9 @@ func CheckEmailInDB(email string) (bool, error) {
func GetUserIDFromEmail(email string) (string, error) {
log.Print(email)
query := `SELECT user_id
query := `SELECT users_id
FROM (
SELECT user_id, 1 AS priority
SELECT users_id, 1 AS priority
FROM users
WHERE email_address = ?
AND is_deleted = 0