22 lines
562 B
Go
22 lines
562 B
Go
package chat
|
|
|
|
import (
|
|
"net/http"
|
|
|
|
"github.com/labstack/echo/v4"
|
|
|
|
"gitflic.ru/akselbant/mtusi2026lab1-fork/dto"
|
|
"gitflic.ru/akselbant/mtusi2026lab1-fork/internal/pkg/domain"
|
|
)
|
|
|
|
func (h *Chat) currentUser(c echo.Context) error {
|
|
user := authenticatedUser(c)
|
|
return c.JSON(http.StatusOK, currentUserResponseFromDomain(user))
|
|
}
|
|
|
|
func currentUserResponseFromDomain(user domain.User) dto.CurrentUserResponse {
|
|
return dto.CurrentUserResponse{
|
|
ID: user.ID, Username: user.Username, DisplayName: user.DisplayName, CreatedAt: dto.Timestamp(user.CreatedAt),
|
|
}
|
|
}
|