Skip to content

Commit

Permalink
#2 - Feat: RsData(REST API 용 ResponseEntity Body DTO) 도입
Browse files Browse the repository at this point in the history
  • Loading branch information
ahah525 committed Nov 8, 2022
1 parent 7e4ffe9 commit 0dd7bab
Showing 1 changed file with 26 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
package com.example.mutbooks.app.base.dto;

import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.Setter;

@Getter
@Setter
@AllArgsConstructor
public class RsData<T> {
private String resultCode;
private String msg;
private T data;

public static <T> RsData<T> of(String resultCode, String msg) {
return new RsData<>(resultCode, msg, null);
}

public boolean isSuccess() {
return resultCode.startsWith("S-1");
}

public boolean isFail() {
return isSuccess() == false;
}
}

0 comments on commit 0dd7bab

Please sign in to comment.