Refactor project structure and update .gitignore; enhance README with setup instructions and environment requirements. Clean up backend code for improved readability and maintainability.

This commit is contained in:
liumangmang
2026-02-04 11:07:42 +08:00
parent 765d05c0a7
commit 7e6ebd18a5
49 changed files with 3381 additions and 3389 deletions

View File

@@ -1,59 +1,59 @@
package com.sshmanager.entity;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.AllArgsConstructor;
import javax.persistence.*;
import java.time.Instant;
@Data
@NoArgsConstructor
@AllArgsConstructor
@Entity
@Table(name = "connections")
public class Connection {
public enum AuthType {
PASSWORD,
PRIVATE_KEY
}
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Long id;
@Column(nullable = false)
private Long userId;
@Column(nullable = false, length = 100)
private String name;
@Column(nullable = false, length = 255)
private String host;
@Column(nullable = false)
private Integer port = 22;
@Column(nullable = false, length = 100)
private String username;
@Enumerated(EnumType.STRING)
@Column(nullable = false)
private AuthType authType = AuthType.PASSWORD;
@Column(columnDefinition = "TEXT")
private String encryptedPassword;
@Column(columnDefinition = "TEXT")
private String encryptedPrivateKey;
@Column(length = 255)
private String passphrase;
@Column(nullable = false)
private Instant createdAt = Instant.now();
@Column(nullable = false)
private Instant updatedAt = Instant.now();
}
package com.sshmanager.entity;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.AllArgsConstructor;
import javax.persistence.*;
import java.time.Instant;
@Data
@NoArgsConstructor
@AllArgsConstructor
@Entity
@Table(name = "connections")
public class Connection {
public enum AuthType {
PASSWORD,
PRIVATE_KEY
}
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Long id;
@Column(nullable = false)
private Long userId;
@Column(nullable = false, length = 100)
private String name;
@Column(nullable = false, length = 255)
private String host;
@Column(nullable = false)
private Integer port = 22;
@Column(nullable = false, length = 100)
private String username;
@Enumerated(EnumType.STRING)
@Column(nullable = false)
private AuthType authType = AuthType.PASSWORD;
@Column(columnDefinition = "TEXT")
private String encryptedPassword;
@Column(columnDefinition = "TEXT")
private String encryptedPrivateKey;
@Column(length = 255)
private String passphrase;
@Column(nullable = false)
private Instant createdAt = Instant.now();
@Column(nullable = false)
private Instant updatedAt = Instant.now();
}

View File

@@ -1,35 +1,35 @@
package com.sshmanager.entity;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.AllArgsConstructor;
import javax.persistence.*;
import java.time.Instant;
@Data
@NoArgsConstructor
@AllArgsConstructor
@Entity
@Table(name = "users")
public class User {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Long id;
@Column(nullable = false, unique = true, length = 50)
private String username;
@Column(nullable = false, length = 255)
private String passwordHash;
@Column(length = 100)
private String displayName;
@Column(nullable = false)
private Instant createdAt = Instant.now();
@Column(nullable = false)
private Instant updatedAt = Instant.now();
}
package com.sshmanager.entity;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.AllArgsConstructor;
import javax.persistence.*;
import java.time.Instant;
@Data
@NoArgsConstructor
@AllArgsConstructor
@Entity
@Table(name = "users")
public class User {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Long id;
@Column(nullable = false, unique = true, length = 50)
private String username;
@Column(nullable = false, length = 255)
private String passwordHash;
@Column(length = 100)
private String displayName;
@Column(nullable = false)
private Instant createdAt = Instant.now();
@Column(nullable = false)
private Instant updatedAt = Instant.now();
}