feat: implement user profile retrieval with roles and permissions caching
This commit is contained in:
@@ -16,8 +16,8 @@ type AdminConfig struct {
|
||||
}
|
||||
|
||||
type JWTConfig struct {
|
||||
SecretKey string
|
||||
ExpirationHours int
|
||||
SecretKey string `mapstructure:"secretkey"`
|
||||
ExpirationHours int `mapstructure:"expirehours"`
|
||||
}
|
||||
|
||||
type DatabaseConfig struct {
|
||||
|
||||
7
internal/models/permission_model.go
Normal file
7
internal/models/permission_model.go
Normal file
@@ -0,0 +1,7 @@
|
||||
package models
|
||||
|
||||
// Permission represents a system permission (e.g., "read:warehouse", "write:component")
|
||||
type Permission struct {
|
||||
Name string `json:"name"`
|
||||
Description string `json:"description"`
|
||||
}
|
||||
@@ -3,6 +3,25 @@ package responses
|
||||
type BodyRegisterResponse struct {
|
||||
ID string `json:"id"`
|
||||
}
|
||||
|
||||
type BodyLoginResponse struct {
|
||||
Token string `json:"token"`
|
||||
}
|
||||
|
||||
// RoleItem represents a role assigned to the user in the profile response.
|
||||
type RoleItem struct {
|
||||
ID string `json:"id"`
|
||||
Name string `json:"name"`
|
||||
Description string `json:"description"`
|
||||
}
|
||||
|
||||
// BodyProfileResponse is the response body for GET /profile.
|
||||
type BodyProfileResponse struct {
|
||||
ID string `json:"id"`
|
||||
Username string `json:"username"`
|
||||
Email string `json:"email"`
|
||||
FullName string `json:"fullName"`
|
||||
IsActive bool `json:"isActive"`
|
||||
Roles []RoleItem `json:"roles"`
|
||||
Permissions []string `json:"permissions"`
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user