feat(dto): lab2 SessionResponse for POST /auth/sessions
This commit is contained in:
@@ -0,0 +1,21 @@
|
|||||||
|
package dto
|
||||||
|
|
||||||
|
import (
|
||||||
|
"high-loud-apps-labs/internal/domain"
|
||||||
|
)
|
||||||
|
|
||||||
|
type SessionResponse struct {
|
||||||
|
Token string `json:"token"`
|
||||||
|
TokenType string `json:"token_type"`
|
||||||
|
ExpiresAt string `json:"expires_at"`
|
||||||
|
User UserResponse `json:"user"`
|
||||||
|
}
|
||||||
|
|
||||||
|
func SessionResponseFromDomain(s *domain.Session, token string, u *domain.User) SessionResponse {
|
||||||
|
return SessionResponse{
|
||||||
|
Token: token,
|
||||||
|
TokenType: "Bearer",
|
||||||
|
ExpiresAt: s.ExpiresAt.UTC().Format(timeFormat),
|
||||||
|
User: UserFromDomain(u),
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user