- GET /api/v1/users/{id} returns email and phone only to the user themself
and to admins.
- When a user changes their own login, the PUT response carries a new token
pair (login is the JWT subject, so the old tokens stop matching); old
refresh tokens fail on their own because the stored login differs.
- The old avatar is deleted only after the profile is saved; login length is
checked against the column size.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
29 lines
831 B
Java
29 lines
831 B
Java
package com.krylov.refound.dto.user;
|
|
|
|
import com.fasterxml.jackson.annotation.JsonInclude;
|
|
import com.krylov.refound.enums.Role;
|
|
import lombok.Builder;
|
|
import lombok.Data;
|
|
|
|
@Data
|
|
@Builder
|
|
public class UserResponseDto {
|
|
private Long id;
|
|
private String login;
|
|
private String name;
|
|
private String lastName;
|
|
private String phone;
|
|
private String email;
|
|
private String avatar;
|
|
private Role role;
|
|
|
|
/**
|
|
* Новая пара токенов — только в ответе PUT /api/v1/users/{id}, когда пользователь
|
|
* сменил свой логин (логин — subject JWT, прежние токены больше не подходят).
|
|
*/
|
|
@JsonInclude(JsonInclude.Include.NON_NULL)
|
|
private String token;
|
|
@JsonInclude(JsonInclude.Include.NON_NULL)
|
|
private String refreshToken;
|
|
}
|