fix: 后端代码格式化

This commit is contained in:
Tim
2025-09-18 14:42:25 +08:00
parent 70f7442f0c
commit 72b2b82e02
325 changed files with 15341 additions and 12370 deletions

View File

@@ -1,15 +1,14 @@
package com.openisle.model;
import jakarta.persistence.*;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
import org.hibernate.annotations.CreationTimestamp;
import java.time.LocalDateTime;
import java.util.EnumSet;
import java.util.HashSet;
import java.util.Set;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
import org.hibernate.annotations.CreationTimestamp;
/**
* Simple user entity with basic fields and a role.
@@ -21,67 +20,79 @@ import java.util.Set;
@NoArgsConstructor
@Table(name = "users")
public class User {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Long id;
@Column(nullable = false, unique = true)
private String username;
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Long id;
@Column(nullable = false, unique = true)
private String email;
@Column(nullable = false, unique = true)
private String username;
@Column(nullable = false)
private String password;
@Column(nullable = false, unique = true)
private String email;
@Column(nullable = false)
private boolean verified = false;
@Column(nullable = false)
private String password;
private String verificationCode;
@Column(nullable = false)
private boolean verified = false;
private String passwordResetCode;
private String verificationCode;
private String avatar;
private String passwordResetCode;
@Column(nullable = false)
private int experience = 0;
private String avatar;
@Column(nullable = false)
private int point = 0;
@Column(nullable = false)
private int experience = 0;
@Column(length = 1000)
private String introduction;
@Column(nullable = false)
private int point = 0;
@Column(length = 1000)
private String registerReason;
@Column(length = 1000)
private String introduction;
@Column(nullable = false)
private boolean approved = true;
@Column(length = 1000)
private String registerReason;
@Enumerated(EnumType.STRING)
@Column(nullable = false)
private Role role = Role.USER;
@Column(nullable = false)
private boolean approved = true;
@Enumerated(EnumType.STRING)
private MedalType displayMedal;
@Enumerated(EnumType.STRING)
@Column(nullable = false)
private Role role = Role.USER;
@ElementCollection(targetClass = NotificationType.class)
@CollectionTable(name = "user_disabled_notification_types", joinColumns = @JoinColumn(name = "user_id"))
@Column(name = "notification_type")
@Enumerated(EnumType.STRING)
private Set<NotificationType> disabledNotificationTypes = EnumSet.of(
NotificationType.POST_VIEWED,
NotificationType.USER_ACTIVITY
);
@Enumerated(EnumType.STRING)
private MedalType displayMedal;
@ElementCollection(targetClass = NotificationType.class)
@CollectionTable(name = "user_disabled_email_notification_types", joinColumns = @JoinColumn(name = "user_id"))
@Column(name = "notification_type")
@Enumerated(EnumType.STRING)
private Set<NotificationType> disabledEmailNotificationTypes = EnumSet.noneOf(NotificationType.class);
@ElementCollection(targetClass = NotificationType.class)
@CollectionTable(
name = "user_disabled_notification_types",
joinColumns = @JoinColumn(name = "user_id")
)
@Column(name = "notification_type")
@Enumerated(EnumType.STRING)
private Set<NotificationType> disabledNotificationTypes = EnumSet.of(
NotificationType.POST_VIEWED,
NotificationType.USER_ACTIVITY
);
@CreationTimestamp
@Column(nullable = false, updatable = false,
columnDefinition = "DATETIME(6) DEFAULT CURRENT_TIMESTAMP(6)")
private LocalDateTime createdAt;
@ElementCollection(targetClass = NotificationType.class)
@CollectionTable(
name = "user_disabled_email_notification_types",
joinColumns = @JoinColumn(name = "user_id")
)
@Column(name = "notification_type")
@Enumerated(EnumType.STRING)
private Set<NotificationType> disabledEmailNotificationTypes = EnumSet.noneOf(
NotificationType.class
);
@CreationTimestamp
@Column(
nullable = false,
updatable = false,
columnDefinition = "DATETIME(6) DEFAULT CURRENT_TIMESTAMP(6)"
)
private LocalDateTime createdAt;
}