@rivascva/dt-idl 1.1.79 → 1.1.81
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.
- package/dist/index.d.ts +85 -37
- package/go/log/log.go +2 -4
- package/go/log/utils.go +8 -3
- package/go/middlewares/middlewares.go +17 -6
- package/go/models/constants.go +4 -2
- package/go/utils/context.go +14 -5
- package/go.mod +4 -1
- package/go.sum +2 -0
- package/package.json +1 -1
- package/services/dt-trade-service.yaml +32 -22
- package/services/dt-user-service.yaml +40 -6
- package/ts/services/dt-trade-service.ts +45 -26
- package/ts/services/dt-user-service.ts +40 -11
package/dist/index.d.ts
CHANGED
|
@@ -692,8 +692,7 @@ interface paths$2 {
|
|
|
692
692
|
path?: never;
|
|
693
693
|
cookie?: never;
|
|
694
694
|
};
|
|
695
|
-
|
|
696
|
-
get: operations$2["getPortfolios"];
|
|
695
|
+
get?: never;
|
|
697
696
|
put?: never;
|
|
698
697
|
/** @description Adds a new portfolio */
|
|
699
698
|
post: operations$2["addPortfolio"];
|
|
@@ -720,6 +719,23 @@ interface paths$2 {
|
|
|
720
719
|
patch?: never;
|
|
721
720
|
trace?: never;
|
|
722
721
|
};
|
|
722
|
+
"/portfolios/by-user/{userId}": {
|
|
723
|
+
parameters: {
|
|
724
|
+
query?: never;
|
|
725
|
+
header?: never;
|
|
726
|
+
path?: never;
|
|
727
|
+
cookie?: never;
|
|
728
|
+
};
|
|
729
|
+
/** @description Gets the portfolios for the given user */
|
|
730
|
+
get: operations$2["getPortfoliosByUser"];
|
|
731
|
+
put?: never;
|
|
732
|
+
post?: never;
|
|
733
|
+
delete?: never;
|
|
734
|
+
options?: never;
|
|
735
|
+
head?: never;
|
|
736
|
+
patch?: never;
|
|
737
|
+
trace?: never;
|
|
738
|
+
};
|
|
723
739
|
"/orders": {
|
|
724
740
|
parameters: {
|
|
725
741
|
query?: never;
|
|
@@ -759,6 +775,8 @@ interface components$2 {
|
|
|
759
775
|
schemas: {
|
|
760
776
|
/** @description Payload to add a new portfolio */
|
|
761
777
|
AddPortfolioPayload: {
|
|
778
|
+
/** @example 123456 */
|
|
779
|
+
userId: string;
|
|
762
780
|
/** @example PERSONAL */
|
|
763
781
|
type: components$2["schemas"]["PortfolioType"];
|
|
764
782
|
/**
|
|
@@ -773,8 +791,6 @@ interface components$2 {
|
|
|
773
791
|
Portfolio: components$2["schemas"]["AddPortfolioPayload"] & {
|
|
774
792
|
/** @example 123456 */
|
|
775
793
|
id: string;
|
|
776
|
-
/** @example 123456 */
|
|
777
|
-
userId: string;
|
|
778
794
|
holdings: components$2["schemas"]["Holding"][];
|
|
779
795
|
orders: components$2["schemas"]["Order"][];
|
|
780
796
|
/**
|
|
@@ -920,28 +936,6 @@ interface components$2 {
|
|
|
920
936
|
pathItems: never;
|
|
921
937
|
}
|
|
922
938
|
interface operations$2 {
|
|
923
|
-
getPortfolios: {
|
|
924
|
-
parameters: {
|
|
925
|
-
query?: never;
|
|
926
|
-
header?: never;
|
|
927
|
-
path?: never;
|
|
928
|
-
cookie?: never;
|
|
929
|
-
};
|
|
930
|
-
requestBody?: never;
|
|
931
|
-
responses: {
|
|
932
|
-
/** @description Success */
|
|
933
|
-
200: {
|
|
934
|
-
headers: {
|
|
935
|
-
[name: string]: unknown;
|
|
936
|
-
};
|
|
937
|
-
content: {
|
|
938
|
-
"application/json": components$2["schemas"]["Portfolio"][];
|
|
939
|
-
};
|
|
940
|
-
};
|
|
941
|
-
404: components$2["responses"]["NotFound"];
|
|
942
|
-
500: components$2["responses"]["InternalServerError"];
|
|
943
|
-
};
|
|
944
|
-
};
|
|
945
939
|
addPortfolio: {
|
|
946
940
|
parameters: {
|
|
947
941
|
query?: never;
|
|
@@ -1001,6 +995,31 @@ interface operations$2 {
|
|
|
1001
995
|
500: components$2["responses"]["InternalServerError"];
|
|
1002
996
|
};
|
|
1003
997
|
};
|
|
998
|
+
getPortfoliosByUser: {
|
|
999
|
+
parameters: {
|
|
1000
|
+
query?: never;
|
|
1001
|
+
header?: never;
|
|
1002
|
+
path: {
|
|
1003
|
+
/** @description The user id */
|
|
1004
|
+
userId: string;
|
|
1005
|
+
};
|
|
1006
|
+
cookie?: never;
|
|
1007
|
+
};
|
|
1008
|
+
requestBody?: never;
|
|
1009
|
+
responses: {
|
|
1010
|
+
/** @description Success */
|
|
1011
|
+
200: {
|
|
1012
|
+
headers: {
|
|
1013
|
+
[name: string]: unknown;
|
|
1014
|
+
};
|
|
1015
|
+
content: {
|
|
1016
|
+
"application/json": components$2["schemas"]["Portfolio"][];
|
|
1017
|
+
};
|
|
1018
|
+
};
|
|
1019
|
+
404: components$2["responses"]["NotFound"];
|
|
1020
|
+
500: components$2["responses"]["InternalServerError"];
|
|
1021
|
+
};
|
|
1022
|
+
};
|
|
1004
1023
|
addOrder: {
|
|
1005
1024
|
parameters: {
|
|
1006
1025
|
query?: never;
|
|
@@ -1112,7 +1131,8 @@ interface paths$1 {
|
|
|
1112
1131
|
path?: never;
|
|
1113
1132
|
cookie?: never;
|
|
1114
1133
|
};
|
|
1115
|
-
|
|
1134
|
+
/** @description Gets all users */
|
|
1135
|
+
get: operations$1["getUsers"];
|
|
1116
1136
|
put?: never;
|
|
1117
1137
|
/** @description Adds a new user */
|
|
1118
1138
|
post: operations$1["addUser"];
|
|
@@ -1122,17 +1142,17 @@ interface paths$1 {
|
|
|
1122
1142
|
patch?: never;
|
|
1123
1143
|
trace?: never;
|
|
1124
1144
|
};
|
|
1125
|
-
"/users/
|
|
1145
|
+
"/users/{userId}": {
|
|
1126
1146
|
parameters: {
|
|
1127
1147
|
query?: never;
|
|
1128
1148
|
header?: never;
|
|
1129
1149
|
path?: never;
|
|
1130
1150
|
cookie?: never;
|
|
1131
1151
|
};
|
|
1132
|
-
/** @description Gets
|
|
1133
|
-
get: operations$1["
|
|
1134
|
-
/** @description Updates
|
|
1135
|
-
put: operations$1["
|
|
1152
|
+
/** @description Gets a user */
|
|
1153
|
+
get: operations$1["getUser"];
|
|
1154
|
+
/** @description Updates an existing user */
|
|
1155
|
+
put: operations$1["updateUser"];
|
|
1136
1156
|
post?: never;
|
|
1137
1157
|
delete?: never;
|
|
1138
1158
|
options?: never;
|
|
@@ -1309,6 +1329,28 @@ interface operations$1 {
|
|
|
1309
1329
|
500: components$1["responses"]["InternalServerError"];
|
|
1310
1330
|
};
|
|
1311
1331
|
};
|
|
1332
|
+
getUsers: {
|
|
1333
|
+
parameters: {
|
|
1334
|
+
query?: never;
|
|
1335
|
+
header?: never;
|
|
1336
|
+
path?: never;
|
|
1337
|
+
cookie?: never;
|
|
1338
|
+
};
|
|
1339
|
+
requestBody?: never;
|
|
1340
|
+
responses: {
|
|
1341
|
+
/** @description Success */
|
|
1342
|
+
200: {
|
|
1343
|
+
headers: {
|
|
1344
|
+
[name: string]: unknown;
|
|
1345
|
+
};
|
|
1346
|
+
content: {
|
|
1347
|
+
"application/json": components$1["schemas"]["User"][];
|
|
1348
|
+
};
|
|
1349
|
+
};
|
|
1350
|
+
404: components$1["responses"]["NotFound"];
|
|
1351
|
+
500: components$1["responses"]["InternalServerError"];
|
|
1352
|
+
};
|
|
1353
|
+
};
|
|
1312
1354
|
addUser: {
|
|
1313
1355
|
parameters: {
|
|
1314
1356
|
query?: never;
|
|
@@ -1336,11 +1378,14 @@ interface operations$1 {
|
|
|
1336
1378
|
500: components$1["responses"]["InternalServerError"];
|
|
1337
1379
|
};
|
|
1338
1380
|
};
|
|
1339
|
-
|
|
1381
|
+
getUser: {
|
|
1340
1382
|
parameters: {
|
|
1341
1383
|
query?: never;
|
|
1342
1384
|
header?: never;
|
|
1343
|
-
path
|
|
1385
|
+
path: {
|
|
1386
|
+
/** @description The user id */
|
|
1387
|
+
userId: string;
|
|
1388
|
+
};
|
|
1344
1389
|
cookie?: never;
|
|
1345
1390
|
};
|
|
1346
1391
|
requestBody?: never;
|
|
@@ -1358,14 +1403,17 @@ interface operations$1 {
|
|
|
1358
1403
|
500: components$1["responses"]["InternalServerError"];
|
|
1359
1404
|
};
|
|
1360
1405
|
};
|
|
1361
|
-
|
|
1406
|
+
updateUser: {
|
|
1362
1407
|
parameters: {
|
|
1363
1408
|
query?: never;
|
|
1364
1409
|
header?: never;
|
|
1365
|
-
path
|
|
1410
|
+
path: {
|
|
1411
|
+
/** @description The user id */
|
|
1412
|
+
userId: string;
|
|
1413
|
+
};
|
|
1366
1414
|
cookie?: never;
|
|
1367
1415
|
};
|
|
1368
|
-
/** @description The request body to update
|
|
1416
|
+
/** @description The request body to update a user */
|
|
1369
1417
|
requestBody: {
|
|
1370
1418
|
content: {
|
|
1371
1419
|
"application/json": components$1["schemas"]["UpdateUserPayload"];
|
package/go/log/log.go
CHANGED
|
@@ -62,11 +62,9 @@ func (l *Log) With(kvs ...any) Logger {
|
|
|
62
62
|
// add the new key-value pairs into the new map
|
|
63
63
|
for i := 0; i < len(kvs); i += 2 {
|
|
64
64
|
k := fmt.Sprintf("%v", kvs[i])
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
v = fmt.Sprintf("%v", kvs[i+1])
|
|
65
|
+
if k != "" && i+1 < len(kvs) {
|
|
66
|
+
newkvs[k] = kvs[i+1]
|
|
68
67
|
}
|
|
69
|
-
newkvs[k] = v
|
|
70
68
|
}
|
|
71
69
|
|
|
72
70
|
return &Log{
|
package/go/log/utils.go
CHANGED
|
@@ -36,7 +36,7 @@ func toJson(m any, kvs map[string]any, level string) string {
|
|
|
36
36
|
// kvsWithContext returns a new kvs map with added context metadata.
|
|
37
37
|
func kvsWithContext(ctx context.Context, kvs map[string]any) map[string]any {
|
|
38
38
|
// copy the existing key-value pairs into a new map
|
|
39
|
-
newkvs := make(map[string]any, len(kvs)+
|
|
39
|
+
newkvs := make(map[string]any, len(kvs)+3)
|
|
40
40
|
maps.Copy(newkvs, kvs)
|
|
41
41
|
|
|
42
42
|
// add the user id to the key-value pairs
|
|
@@ -45,8 +45,13 @@ func kvsWithContext(ctx context.Context, kvs map[string]any) map[string]any {
|
|
|
45
45
|
}
|
|
46
46
|
|
|
47
47
|
// add the request path to the key-value pairs
|
|
48
|
-
if
|
|
49
|
-
newkvs["
|
|
48
|
+
if requestPath, err := utils.GetRequestPathFromContext(ctx); err == nil {
|
|
49
|
+
newkvs["requestPath"] = requestPath
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
// add the request id to the key-value pairs
|
|
53
|
+
if requestId, err := utils.GetRequestIdFromContext(ctx); err == nil {
|
|
54
|
+
newkvs["requestId"] = requestId
|
|
50
55
|
}
|
|
51
56
|
|
|
52
57
|
return newkvs
|
|
@@ -10,6 +10,7 @@ import (
|
|
|
10
10
|
"github.com/RivasCVA/dt-idl/go/log"
|
|
11
11
|
"github.com/RivasCVA/dt-idl/go/models"
|
|
12
12
|
"github.com/RivasCVA/dt-idl/go/write"
|
|
13
|
+
"github.com/google/uuid"
|
|
13
14
|
)
|
|
14
15
|
|
|
15
16
|
// GetAuthMiddleware returns a middleware function that authenticates all requests, except for the login endpoints.
|
|
@@ -19,7 +20,7 @@ func GetAuthMiddleware(secret string) func(http.Handler) http.Handler {
|
|
|
19
20
|
|
|
20
21
|
return func(next http.Handler) http.Handler {
|
|
21
22
|
return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
|
|
22
|
-
// check if the request is a login endpoint
|
|
23
|
+
// check if the request path is a login endpoint
|
|
23
24
|
if slices.Contains([]string{"/v1/login", "/v1/login/provider"}, r.URL.Path) {
|
|
24
25
|
next.ServeHTTP(w, r)
|
|
25
26
|
return
|
|
@@ -49,13 +50,23 @@ func GetAuthMiddleware(secret string) func(http.Handler) http.Handler {
|
|
|
49
50
|
}
|
|
50
51
|
}
|
|
51
52
|
|
|
52
|
-
//
|
|
53
|
-
func
|
|
53
|
+
// CommonContext adds shared values to the request context.
|
|
54
|
+
func CommonContext(next http.Handler) http.Handler {
|
|
54
55
|
return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
|
|
55
|
-
//
|
|
56
|
-
ctx :=
|
|
57
|
-
|
|
56
|
+
// get the request context
|
|
57
|
+
ctx := r.Context()
|
|
58
|
+
|
|
59
|
+
// set the request id in the request context
|
|
60
|
+
requestId := r.Header.Get("X-Request-Id")
|
|
61
|
+
if requestId == "" {
|
|
62
|
+
requestId = uuid.New().String()
|
|
63
|
+
}
|
|
64
|
+
ctx = context.WithValue(ctx, models.RequestIdKey, requestId)
|
|
58
65
|
|
|
66
|
+
// set the request path in the request context
|
|
67
|
+
ctx = context.WithValue(ctx, models.RequestPathKey, r.URL.Path)
|
|
68
|
+
|
|
69
|
+
r = r.WithContext(ctx)
|
|
59
70
|
next.ServeHTTP(w, r)
|
|
60
71
|
})
|
|
61
72
|
}
|
package/go/models/constants.go
CHANGED
|
@@ -6,6 +6,8 @@ type ContextKey string
|
|
|
6
6
|
const (
|
|
7
7
|
// TokenKey is the key used to set/get the JWT token in the request context.
|
|
8
8
|
TokenKey = ContextKey("token")
|
|
9
|
-
//
|
|
10
|
-
|
|
9
|
+
// RequestPathKey is the key used to set/get the request path in the request context.
|
|
10
|
+
RequestPathKey = ContextKey("requestPath")
|
|
11
|
+
// RequestIdKey is the key used to set/get the request id in the request context.
|
|
12
|
+
RequestIdKey = ContextKey("requestId")
|
|
11
13
|
)
|
package/go/utils/context.go
CHANGED
|
@@ -38,11 +38,20 @@ func GetUserIdFromContext(ctx context.Context) (string, error) {
|
|
|
38
38
|
return userId, nil
|
|
39
39
|
}
|
|
40
40
|
|
|
41
|
-
//
|
|
42
|
-
func
|
|
43
|
-
|
|
41
|
+
// GetRequestPathFromContext retrieves the request path from the given context.
|
|
42
|
+
func GetRequestPathFromContext(ctx context.Context) (string, error) {
|
|
43
|
+
requestPath, ok := ctx.Value(models.RequestPathKey).(string)
|
|
44
44
|
if !ok {
|
|
45
|
-
return "", errors.New("path not found in the context")
|
|
45
|
+
return "", errors.New("request path not found in the context")
|
|
46
46
|
}
|
|
47
|
-
return
|
|
47
|
+
return requestPath, nil
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
// GetRequestIdFromContext retrieves the request id from the given context.
|
|
51
|
+
func GetRequestIdFromContext(ctx context.Context) (string, error) {
|
|
52
|
+
requestId, ok := ctx.Value(models.RequestIdKey).(string)
|
|
53
|
+
if !ok {
|
|
54
|
+
return "", errors.New("request id not found in the context")
|
|
55
|
+
}
|
|
56
|
+
return requestId, nil
|
|
48
57
|
}
|
package/go.mod
CHANGED
package/go.sum
CHANGED
|
@@ -1,2 +1,4 @@
|
|
|
1
1
|
github.com/golang-jwt/jwt/v5 v5.2.2 h1:Rl4B7itRWVtYIHFrSNd7vhTiz9UpLdi6gZhZ3wEeDy8=
|
|
2
2
|
github.com/golang-jwt/jwt/v5 v5.2.2/go.mod h1:pqrtFR0X4osieyHYxtmOUWsAWrfe1Q5UVIyoH402zdk=
|
|
3
|
+
github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0=
|
|
4
|
+
github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
|
package/package.json
CHANGED
|
@@ -10,24 +10,6 @@ servers:
|
|
|
10
10
|
|
|
11
11
|
paths:
|
|
12
12
|
/portfolios:
|
|
13
|
-
get:
|
|
14
|
-
description: Gets all portfolios
|
|
15
|
-
operationId: getPortfolios
|
|
16
|
-
tags:
|
|
17
|
-
- Portfolios
|
|
18
|
-
responses:
|
|
19
|
-
200:
|
|
20
|
-
description: Success
|
|
21
|
-
content:
|
|
22
|
-
application/json:
|
|
23
|
-
schema:
|
|
24
|
-
type: array
|
|
25
|
-
items:
|
|
26
|
-
$ref: '#/components/schemas/Portfolio'
|
|
27
|
-
404:
|
|
28
|
-
$ref: '#/components/responses/NotFound'
|
|
29
|
-
500:
|
|
30
|
-
$ref: '#/components/responses/InternalServerError'
|
|
31
13
|
post:
|
|
32
14
|
description: Adds a new portfolio
|
|
33
15
|
operationId: addPortfolio
|
|
@@ -89,6 +71,34 @@ paths:
|
|
|
89
71
|
500:
|
|
90
72
|
$ref: '#/components/responses/InternalServerError'
|
|
91
73
|
|
|
74
|
+
/portfolios/by-user/{userId}:
|
|
75
|
+
get:
|
|
76
|
+
description: Gets the portfolios for the given user
|
|
77
|
+
operationId: getPortfoliosByUser
|
|
78
|
+
tags:
|
|
79
|
+
- Portfolios
|
|
80
|
+
parameters:
|
|
81
|
+
- in: path
|
|
82
|
+
name: userId
|
|
83
|
+
description: The user id
|
|
84
|
+
required: true
|
|
85
|
+
schema:
|
|
86
|
+
type: string
|
|
87
|
+
example: 123456
|
|
88
|
+
responses:
|
|
89
|
+
200:
|
|
90
|
+
description: Success
|
|
91
|
+
content:
|
|
92
|
+
application/json:
|
|
93
|
+
schema:
|
|
94
|
+
type: array
|
|
95
|
+
items:
|
|
96
|
+
$ref: '#/components/schemas/Portfolio'
|
|
97
|
+
404:
|
|
98
|
+
$ref: '#/components/responses/NotFound'
|
|
99
|
+
500:
|
|
100
|
+
$ref: '#/components/responses/InternalServerError'
|
|
101
|
+
|
|
92
102
|
/orders:
|
|
93
103
|
post:
|
|
94
104
|
description: Adds a new order
|
|
@@ -145,6 +155,9 @@ components:
|
|
|
145
155
|
AddPortfolioPayload:
|
|
146
156
|
description: Payload to add a new portfolio
|
|
147
157
|
properties:
|
|
158
|
+
userId:
|
|
159
|
+
type: string
|
|
160
|
+
example: 123456
|
|
148
161
|
type:
|
|
149
162
|
$ref: '#/components/schemas/PortfolioType'
|
|
150
163
|
example: PERSONAL
|
|
@@ -153,6 +166,7 @@ components:
|
|
|
153
166
|
format: double
|
|
154
167
|
example: 10500.25
|
|
155
168
|
required:
|
|
169
|
+
- userId
|
|
156
170
|
- type
|
|
157
171
|
- cash
|
|
158
172
|
|
|
@@ -170,9 +184,6 @@ components:
|
|
|
170
184
|
id:
|
|
171
185
|
type: string
|
|
172
186
|
example: 123456
|
|
173
|
-
userId:
|
|
174
|
-
type: string
|
|
175
|
-
example: 123456
|
|
176
187
|
holdings:
|
|
177
188
|
type: array
|
|
178
189
|
items:
|
|
@@ -191,7 +202,6 @@ components:
|
|
|
191
202
|
example: 1713398544000
|
|
192
203
|
required:
|
|
193
204
|
- id
|
|
194
|
-
- userId
|
|
195
205
|
- holdings
|
|
196
206
|
- orders
|
|
197
207
|
- dateCreated
|
|
@@ -67,6 +67,24 @@ paths:
|
|
|
67
67
|
$ref: '#/components/responses/InternalServerError'
|
|
68
68
|
|
|
69
69
|
/users:
|
|
70
|
+
get:
|
|
71
|
+
description: Gets all users
|
|
72
|
+
operationId: getUsers
|
|
73
|
+
tags:
|
|
74
|
+
- Users
|
|
75
|
+
responses:
|
|
76
|
+
200:
|
|
77
|
+
description: Success
|
|
78
|
+
content:
|
|
79
|
+
application/json:
|
|
80
|
+
schema:
|
|
81
|
+
type: array
|
|
82
|
+
items:
|
|
83
|
+
$ref: '#/components/schemas/User'
|
|
84
|
+
404:
|
|
85
|
+
$ref: '#/components/responses/NotFound'
|
|
86
|
+
500:
|
|
87
|
+
$ref: '#/components/responses/InternalServerError'
|
|
70
88
|
post:
|
|
71
89
|
description: Adds a new user
|
|
72
90
|
operationId: addUser
|
|
@@ -91,12 +109,20 @@ paths:
|
|
|
91
109
|
500:
|
|
92
110
|
$ref: '#/components/responses/InternalServerError'
|
|
93
111
|
|
|
94
|
-
/users/
|
|
112
|
+
/users/{userId}:
|
|
95
113
|
get:
|
|
96
|
-
description: Gets
|
|
97
|
-
operationId:
|
|
114
|
+
description: Gets a user
|
|
115
|
+
operationId: getUser
|
|
98
116
|
tags:
|
|
99
117
|
- Users
|
|
118
|
+
parameters:
|
|
119
|
+
- in: path
|
|
120
|
+
name: userId
|
|
121
|
+
description: The user id
|
|
122
|
+
required: true
|
|
123
|
+
schema:
|
|
124
|
+
type: string
|
|
125
|
+
example: 123456
|
|
100
126
|
responses:
|
|
101
127
|
200:
|
|
102
128
|
description: Success
|
|
@@ -110,12 +136,20 @@ paths:
|
|
|
110
136
|
500:
|
|
111
137
|
$ref: '#/components/responses/InternalServerError'
|
|
112
138
|
put:
|
|
113
|
-
description: Updates
|
|
114
|
-
operationId:
|
|
139
|
+
description: Updates an existing user
|
|
140
|
+
operationId: updateUser
|
|
115
141
|
tags:
|
|
116
142
|
- Users
|
|
143
|
+
parameters:
|
|
144
|
+
- in: path
|
|
145
|
+
name: userId
|
|
146
|
+
description: The user id
|
|
147
|
+
required: true
|
|
148
|
+
schema:
|
|
149
|
+
type: string
|
|
150
|
+
example: 123456
|
|
117
151
|
requestBody:
|
|
118
|
-
description: The request body to update
|
|
152
|
+
description: The request body to update a user
|
|
119
153
|
required: true
|
|
120
154
|
content:
|
|
121
155
|
application/json:
|
|
@@ -11,8 +11,7 @@ export interface paths {
|
|
|
11
11
|
path?: never;
|
|
12
12
|
cookie?: never;
|
|
13
13
|
};
|
|
14
|
-
|
|
15
|
-
get: operations["getPortfolios"];
|
|
14
|
+
get?: never;
|
|
16
15
|
put?: never;
|
|
17
16
|
/** @description Adds a new portfolio */
|
|
18
17
|
post: operations["addPortfolio"];
|
|
@@ -39,6 +38,23 @@ export interface paths {
|
|
|
39
38
|
patch?: never;
|
|
40
39
|
trace?: never;
|
|
41
40
|
};
|
|
41
|
+
"/portfolios/by-user/{userId}": {
|
|
42
|
+
parameters: {
|
|
43
|
+
query?: never;
|
|
44
|
+
header?: never;
|
|
45
|
+
path?: never;
|
|
46
|
+
cookie?: never;
|
|
47
|
+
};
|
|
48
|
+
/** @description Gets the portfolios for the given user */
|
|
49
|
+
get: operations["getPortfoliosByUser"];
|
|
50
|
+
put?: never;
|
|
51
|
+
post?: never;
|
|
52
|
+
delete?: never;
|
|
53
|
+
options?: never;
|
|
54
|
+
head?: never;
|
|
55
|
+
patch?: never;
|
|
56
|
+
trace?: never;
|
|
57
|
+
};
|
|
42
58
|
"/orders": {
|
|
43
59
|
parameters: {
|
|
44
60
|
query?: never;
|
|
@@ -79,6 +95,8 @@ export interface components {
|
|
|
79
95
|
schemas: {
|
|
80
96
|
/** @description Payload to add a new portfolio */
|
|
81
97
|
AddPortfolioPayload: {
|
|
98
|
+
/** @example 123456 */
|
|
99
|
+
userId: string;
|
|
82
100
|
/** @example PERSONAL */
|
|
83
101
|
type: components["schemas"]["PortfolioType"];
|
|
84
102
|
/**
|
|
@@ -93,8 +111,6 @@ export interface components {
|
|
|
93
111
|
Portfolio: components["schemas"]["AddPortfolioPayload"] & {
|
|
94
112
|
/** @example 123456 */
|
|
95
113
|
id: string;
|
|
96
|
-
/** @example 123456 */
|
|
97
|
-
userId: string;
|
|
98
114
|
holdings: components["schemas"]["Holding"][];
|
|
99
115
|
orders: components["schemas"]["Order"][];
|
|
100
116
|
/**
|
|
@@ -241,28 +257,6 @@ export interface components {
|
|
|
241
257
|
}
|
|
242
258
|
export type $defs = Record<string, never>;
|
|
243
259
|
export interface operations {
|
|
244
|
-
getPortfolios: {
|
|
245
|
-
parameters: {
|
|
246
|
-
query?: never;
|
|
247
|
-
header?: never;
|
|
248
|
-
path?: never;
|
|
249
|
-
cookie?: never;
|
|
250
|
-
};
|
|
251
|
-
requestBody?: never;
|
|
252
|
-
responses: {
|
|
253
|
-
/** @description Success */
|
|
254
|
-
200: {
|
|
255
|
-
headers: {
|
|
256
|
-
[name: string]: unknown;
|
|
257
|
-
};
|
|
258
|
-
content: {
|
|
259
|
-
"application/json": components["schemas"]["Portfolio"][];
|
|
260
|
-
};
|
|
261
|
-
};
|
|
262
|
-
404: components["responses"]["NotFound"];
|
|
263
|
-
500: components["responses"]["InternalServerError"];
|
|
264
|
-
};
|
|
265
|
-
};
|
|
266
260
|
addPortfolio: {
|
|
267
261
|
parameters: {
|
|
268
262
|
query?: never;
|
|
@@ -322,6 +316,31 @@ export interface operations {
|
|
|
322
316
|
500: components["responses"]["InternalServerError"];
|
|
323
317
|
};
|
|
324
318
|
};
|
|
319
|
+
getPortfoliosByUser: {
|
|
320
|
+
parameters: {
|
|
321
|
+
query?: never;
|
|
322
|
+
header?: never;
|
|
323
|
+
path: {
|
|
324
|
+
/** @description The user id */
|
|
325
|
+
userId: string;
|
|
326
|
+
};
|
|
327
|
+
cookie?: never;
|
|
328
|
+
};
|
|
329
|
+
requestBody?: never;
|
|
330
|
+
responses: {
|
|
331
|
+
/** @description Success */
|
|
332
|
+
200: {
|
|
333
|
+
headers: {
|
|
334
|
+
[name: string]: unknown;
|
|
335
|
+
};
|
|
336
|
+
content: {
|
|
337
|
+
"application/json": components["schemas"]["Portfolio"][];
|
|
338
|
+
};
|
|
339
|
+
};
|
|
340
|
+
404: components["responses"]["NotFound"];
|
|
341
|
+
500: components["responses"]["InternalServerError"];
|
|
342
|
+
};
|
|
343
|
+
};
|
|
325
344
|
addOrder: {
|
|
326
345
|
parameters: {
|
|
327
346
|
query?: never;
|
|
@@ -62,7 +62,8 @@ export interface paths {
|
|
|
62
62
|
path?: never;
|
|
63
63
|
cookie?: never;
|
|
64
64
|
};
|
|
65
|
-
|
|
65
|
+
/** @description Gets all users */
|
|
66
|
+
get: operations["getUsers"];
|
|
66
67
|
put?: never;
|
|
67
68
|
/** @description Adds a new user */
|
|
68
69
|
post: operations["addUser"];
|
|
@@ -72,17 +73,17 @@ export interface paths {
|
|
|
72
73
|
patch?: never;
|
|
73
74
|
trace?: never;
|
|
74
75
|
};
|
|
75
|
-
"/users/
|
|
76
|
+
"/users/{userId}": {
|
|
76
77
|
parameters: {
|
|
77
78
|
query?: never;
|
|
78
79
|
header?: never;
|
|
79
80
|
path?: never;
|
|
80
81
|
cookie?: never;
|
|
81
82
|
};
|
|
82
|
-
/** @description Gets
|
|
83
|
-
get: operations["
|
|
84
|
-
/** @description Updates
|
|
85
|
-
put: operations["
|
|
83
|
+
/** @description Gets a user */
|
|
84
|
+
get: operations["getUser"];
|
|
85
|
+
/** @description Updates an existing user */
|
|
86
|
+
put: operations["updateUser"];
|
|
86
87
|
post?: never;
|
|
87
88
|
delete?: never;
|
|
88
89
|
options?: never;
|
|
@@ -261,6 +262,28 @@ export interface operations {
|
|
|
261
262
|
500: components["responses"]["InternalServerError"];
|
|
262
263
|
};
|
|
263
264
|
};
|
|
265
|
+
getUsers: {
|
|
266
|
+
parameters: {
|
|
267
|
+
query?: never;
|
|
268
|
+
header?: never;
|
|
269
|
+
path?: never;
|
|
270
|
+
cookie?: never;
|
|
271
|
+
};
|
|
272
|
+
requestBody?: never;
|
|
273
|
+
responses: {
|
|
274
|
+
/** @description Success */
|
|
275
|
+
200: {
|
|
276
|
+
headers: {
|
|
277
|
+
[name: string]: unknown;
|
|
278
|
+
};
|
|
279
|
+
content: {
|
|
280
|
+
"application/json": components["schemas"]["User"][];
|
|
281
|
+
};
|
|
282
|
+
};
|
|
283
|
+
404: components["responses"]["NotFound"];
|
|
284
|
+
500: components["responses"]["InternalServerError"];
|
|
285
|
+
};
|
|
286
|
+
};
|
|
264
287
|
addUser: {
|
|
265
288
|
parameters: {
|
|
266
289
|
query?: never;
|
|
@@ -288,11 +311,14 @@ export interface operations {
|
|
|
288
311
|
500: components["responses"]["InternalServerError"];
|
|
289
312
|
};
|
|
290
313
|
};
|
|
291
|
-
|
|
314
|
+
getUser: {
|
|
292
315
|
parameters: {
|
|
293
316
|
query?: never;
|
|
294
317
|
header?: never;
|
|
295
|
-
path
|
|
318
|
+
path: {
|
|
319
|
+
/** @description The user id */
|
|
320
|
+
userId: string;
|
|
321
|
+
};
|
|
296
322
|
cookie?: never;
|
|
297
323
|
};
|
|
298
324
|
requestBody?: never;
|
|
@@ -310,14 +336,17 @@ export interface operations {
|
|
|
310
336
|
500: components["responses"]["InternalServerError"];
|
|
311
337
|
};
|
|
312
338
|
};
|
|
313
|
-
|
|
339
|
+
updateUser: {
|
|
314
340
|
parameters: {
|
|
315
341
|
query?: never;
|
|
316
342
|
header?: never;
|
|
317
|
-
path
|
|
343
|
+
path: {
|
|
344
|
+
/** @description The user id */
|
|
345
|
+
userId: string;
|
|
346
|
+
};
|
|
318
347
|
cookie?: never;
|
|
319
348
|
};
|
|
320
|
-
/** @description The request body to update
|
|
349
|
+
/** @description The request body to update a user */
|
|
321
350
|
requestBody: {
|
|
322
351
|
content: {
|
|
323
352
|
"application/json": components["schemas"]["UpdateUserPayload"];
|