This repository has been archived by the owner on Dec 5, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
31 changed files
with
132 additions
and
349 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,24 @@ | ||
version: "3.8" | ||
|
||
services: | ||
mysql: | ||
image: mariadb:10.4 | ||
ports: | ||
- "3306:3306" | ||
environment: | ||
MYSQL_DATABASE: saltynote | ||
MYSQL_ROOT_PASSWORD: password | ||
volumes: | ||
- mysql_data:/var/lib/mysql/data | ||
|
||
redis: | ||
image: 'redis:7.0-alpine' | ||
command: redis-server --requirepass 88888888 | ||
ports: | ||
- '6379:6379' | ||
|
||
mongodb: | ||
image: mongo:6-jammy | ||
restart: always | ||
environment: | ||
MONGO_INITDB_ROOT_USERNAME: saltynote | ||
MONGO_INITDB_ROOT_PASSWORD: password | ||
MONGO_INITDB_DATABASE: saltynote | ||
ports: | ||
- '27017:27017' | ||
volumes: | ||
- mongo_data:/data/db | ||
|
||
volumes: | ||
mysql_data: | ||
mongo_data: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,6 +2,6 @@ | |
|
||
public interface Identifiable { | ||
|
||
Long getId(); | ||
String getId(); | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
36 changes: 7 additions & 29 deletions
36
src/main/java/com/saltynote/service/entity/LoginHistory.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,50 +1,28 @@ | ||
package com.saltynote.service.entity; | ||
|
||
import jakarta.persistence.Column; | ||
import jakarta.persistence.Entity; | ||
import jakarta.persistence.GeneratedValue; | ||
import jakarta.persistence.GenerationType; | ||
import jakarta.persistence.Id; | ||
import jakarta.persistence.PrePersist; | ||
import jakarta.persistence.Table; | ||
import jakarta.validation.constraints.NotNull; | ||
import jakarta.validation.constraints.Size; | ||
import lombok.Getter; | ||
import lombok.Setter; | ||
import lombok.experimental.Accessors; | ||
import org.springframework.data.annotation.Id; | ||
import org.springframework.data.mongodb.core.mapping.Document; | ||
|
||
import java.sql.Timestamp; | ||
import java.util.Date; | ||
|
||
@Entity | ||
@Table(name = "login_history") | ||
@Document | ||
@Getter | ||
@Setter | ||
@Accessors(chain = true) | ||
public class LoginHistory { | ||
|
||
@Id | ||
@GeneratedValue(strategy = GenerationType.IDENTITY) | ||
@Column(name = "id", nullable = false) | ||
private Integer id; | ||
private String id; | ||
|
||
@Column(name = "user_id") | ||
private Long userId; | ||
private String userId; | ||
|
||
@Size(max = 128) | ||
@Column(name = "remote_ip", length = 128) | ||
private String remoteIp; | ||
|
||
@Size(max = 256) | ||
@Column(name = "user_agent", length = 256) | ||
private String userAgent; | ||
|
||
@NotNull | ||
@Column(name = "login_time", nullable = false) | ||
private Timestamp loginTime; | ||
|
||
@PrePersist | ||
private void beforeSave() { | ||
this.loginTime = new Timestamp(System.currentTimeMillis()); | ||
} | ||
private Date loginTime = new Date(); | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.