@ahhaohho/response-dto 1.3.6 → 1.4.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/ResponseDTO.js +25 -23
  2. package/package.json +1 -1
package/ResponseDTO.js CHANGED
@@ -6,48 +6,48 @@ class ResponseDTO {
6
6
  this.message = message;
7
7
  }
8
8
 
9
- static success(data = null, message = null) {
10
- return new ResponseDTO('success', 200, message, data);
9
+ static success(data = null, message = null, type = 'success', status = 200) {
10
+ return new ResponseDTO(type, status, data, message);
11
11
  }
12
12
 
13
- static created(data = null, message = null) {
14
- return new ResponseDTO('success', 201, message, data);
13
+ static created(data = null, message = null, type = 'success', status = 201) {
14
+ return new ResponseDTO(type, status, data, message);
15
15
  }
16
16
 
17
- static noContent(message = null) {
18
- return new ResponseDTO('success', 204, null, message);
17
+ static noContent(message = null, type = 'success', status = 204) {
18
+ return new ResponseDTO(type, status, null, message);
19
19
  }
20
20
 
21
- static badRequest(message) {
22
- return new ResponseDTO('client', 400, null, message);
21
+ static badRequest(message, type = 'client', status = 400) {
22
+ return new ResponseDTO(type, status, null, message);
23
23
  }
24
24
 
25
- static unauthorized(message) {
26
- return new ResponseDTO('client', 401, null, message);
25
+ static unauthorized(message, type = 'client', status = 401) {
26
+ return new ResponseDTO(type, status, null, message);
27
27
  }
28
28
 
29
- static forbidden(message) {
30
- return new ResponseDTO('client', 403, null, message);
29
+ static forbidden(message, type = 'client', status = 403) {
30
+ return new ResponseDTO(type, status, null, message);
31
31
  }
32
32
 
33
- static notFound(message) {
34
- return new ResponseDTO('client', 404, null, message);
33
+ static notFound(message, type = 'client', status = 404) {
34
+ return new ResponseDTO(type, status, null, message);
35
35
  }
36
36
 
37
- static conflict(message) {
38
- return new ResponseDTO('client', 409, null, message);
37
+ static conflict(message, type = 'client', status = 409) {
38
+ return new ResponseDTO(type, status, null, message);
39
39
  }
40
40
 
41
- static validationError(message) {
42
- return new ResponseDTO('client', 422, null, message);
41
+ static validationError(message, type = 'client', status = 422) {
42
+ return new ResponseDTO(type, status, null, message);
43
43
  }
44
44
 
45
- static systemError(message) {
46
- return new ResponseDTO('system', 500, null, message);
45
+ static systemError(message, type = 'system', status = 500) {
46
+ return new ResponseDTO(type, status, null, message);
47
47
  }
48
48
 
49
- static serviceUnavailable(message) {
50
- return new ResponseDTO('system', 503, null, message);
49
+ static serviceUnavailable(message, type = 'system', status = 503) {
50
+ return new ResponseDTO(type, status, null, message);
51
51
  }
52
52
 
53
53
  toJSON() {
@@ -68,4 +68,6 @@ class ResponseDTO {
68
68
  }
69
69
  }
70
70
 
71
- module.exports = ResponseDTO;
71
+ module.exports = ResponseDTO;
72
+
73
+
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ahhaohho/response-dto",
3
- "version": "1.3.6",
3
+ "version": "1.4.1",
4
4
  "description": "AhhaOhho API 응답을 위한 DTO 클래스",
5
5
  "main": "index.js",
6
6
  "scripts": {