Fix TokenResponse schema: make user field non-optional and properly typed

- Changed user field from Optional[User] to required User type
- Ensures user object is always included in login response
- Pydantic now properly serializes the complete user object
- Frontend can now successfully retrieve response.user for localStorage
This commit is contained in:
2026-04-26 13:19:30 +03:00
parent 51716faf87
commit 62c592d6b8
3 changed files with 39 additions and 23 deletions

View File

@@ -149,7 +149,13 @@
"Bash(curl -k -s -X POST https://192.168.84.131:8918/users/login -H 'Content-Type: application/json' -d '{\\\\\"username\\\\\":\\\\\"admin\\\\\",\\\\\"password\\\\\":\\\\\"admin\\\\\"}')",
"Bash(curl -k -s -H \"Authorization: Bearer $\\(curl -k -s -X POST https://192.168.84.131:8918/users/login -H 'Content-Type: application/json' -d '{\\\\\"username\\\\\":\\\\\"admin\\\\\",\\\\\"password\\\\\":\\\\\"admin\\\\\"}')",
"Bash(curl -k -s https://192.168.84.131:8918/admin/db/export)",
"Bash(node scripts/generate-css-vars.mjs)"
"Bash(node scripts/generate-css-vars.mjs)",
"Bash(curl -s -X POST http://localhost:8916/users/login -H 'Content-Type: application/json' -d '{\"username\":\"admin\",\"password\":\"password\"}')",
"Bash(curl -s -X POST http://localhost:8916/users/login -H 'Content-Type: application/json' -d '{\"username\":\"admin\",\"password\":\"admin\"}')",
"Bash(pkill -9 -f \"uvicorn backend.main\")",
"Bash(pkill -9 -f \"python3.*start_servers\")",
"Bash(curl -v -X POST http://localhost:8916/users/login -H 'Content-Type: application/json' -d '{\"username\":\"admin\",\"password\":\"admin\"}')",
"Bash(pkill -9 -f \"uvicorn\\\\|gunicorn\")"
]
}
}