Skip to content

Commit

Permalink
Merge pull request #5 from Sopo2023/style/#3
Browse files Browse the repository at this point in the history
Style/#3
  • Loading branch information
alexipharmical authored Jul 22, 2024
2 parents 3b7c7ca + 44e6271 commit 04e5ad8
Show file tree
Hide file tree
Showing 3 changed files with 50 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
package kr.hs.dgsw.SOPO_server_v2.global.common.entity;

import jakarta.persistence.EntityListeners;
import jakarta.persistence.MappedSuperclass;
import lombok.AccessLevel;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.experimental.SuperBuilder;
import org.springframework.data.annotation.CreatedDate;
import org.springframework.data.annotation.LastModifiedDate;
import org.springframework.data.jpa.domain.support.AuditingEntityListener;

import java.time.LocalDateTime;

@Getter
@SuperBuilder
@MappedSuperclass
@NoArgsConstructor(access = AccessLevel.PROTECTED)
@EntityListeners(AuditingEntityListener.class)
public abstract class BaseTimeEntity {

@CreatedDate
private LocalDateTime createdAt;

@LastModifiedDate
private LocalDateTime modifiedAt;

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
package kr.hs.dgsw.SOPO_server_v2.global.response;

import org.springframework.http.HttpStatus;

public record Response(int status, String message) {
public static Response of(HttpStatus status, String message) {
return new Response(status.value(), message);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
package kr.hs.dgsw.SOPO_server_v2.global.response;

import org.springframework.http.HttpStatus;

public record ResponseData<T>(
int status,
String message,
T data
) {
public static <T> ResponseData<T> of(HttpStatus status, String message, T data) {
return new ResponseData<>(status.value(), message, data);
}
}

0 comments on commit 04e5ad8

Please sign in to comment.