Skip to content

Commit 523e4f7

Browse files
authored
feat(accounts): get (#225)
Signed-off-by: Lexus Drumgold <[email protected]>
1 parent 039ee1b commit 523e4f7

File tree

17 files changed

+762
-130
lines changed

17 files changed

+762
-130
lines changed

__tests__/utils/stub500.mts

Lines changed: 15 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -4,33 +4,27 @@
44
*/
55

66
/**
7-
* Create an object with a method named `method` that throws an error.
7+
* Create a function that throws an error.
88
*
99
* @this {void}
1010
*
1111
* @param {string} url
1212
* The endpoint being tested
13-
* @param {string} method
14-
* The name of the method to stub
15-
* @return {Record<string, (this: void) => never>}
16-
* Object with `method` stub
13+
* @return {(this: void) => never}
14+
* Error stub
1715
*/
18-
function stub500(
19-
this: void,
20-
url: string,
21-
method: string
22-
): Record<string, (this: void) => never> {
23-
return {
24-
/**
25-
* @this {void}
26-
*
27-
* @return {never}
28-
* Never
29-
* @throws {Error}
30-
*/
31-
[method](this: void): never {
32-
throw new Error(url)
33-
}
16+
function stub500(this: void, url: string): (this: void) => never {
17+
return stub
18+
19+
/**
20+
* @this {void}
21+
*
22+
* @return {never}
23+
* Never
24+
* @throws {Error}
25+
*/
26+
function stub(this: void): never {
27+
throw new Error(url)
3428
}
3529
}
3630

src/__snapshots__/app.e2e.snap

Lines changed: 96 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -130,6 +130,75 @@ exports[`e2e:app > GET / > should respond with api documentation (json) 1`] = `
130130
"tags": [
131131
"accounts"
132132
]
133+
},
134+
"get": {
135+
"operationId": "accounts-get",
136+
"parameters": [
137+
{
138+
"name": "uid",
139+
"required": true,
140+
"in": "path",
141+
"description": "id of account to retrieve",
142+
"schema": {
143+
"type": "string"
144+
}
145+
}
146+
],
147+
"responses": {
148+
"200": {
149+
"content": {
150+
"application/json": {
151+
"schema": {
152+
"$ref": "#/components/schemas/AccountPayload"
153+
}
154+
}
155+
}
156+
},
157+
"401": {
158+
"content": {
159+
"application/json": {
160+
"schema": {
161+
"$ref": "#/components/schemas/InvalidCredentialException"
162+
}
163+
}
164+
}
165+
},
166+
"403": {
167+
"content": {
168+
"application/json": {
169+
"schema": {
170+
"$ref": "#/components/schemas/AccessDeniedException"
171+
}
172+
}
173+
}
174+
},
175+
"404": {
176+
"content": {
177+
"application/json": {
178+
"schema": {
179+
"$ref": "#/components/schemas/MissingAccountException"
180+
}
181+
}
182+
}
183+
},
184+
"500": {
185+
"content": {
186+
"application/json": {
187+
"schema": {
188+
"$ref": "#/components/schemas/InternalServerException"
189+
}
190+
}
191+
}
192+
}
193+
},
194+
"security": [
195+
{
196+
"jwt": []
197+
}
198+
],
199+
"tags": [
200+
"accounts"
201+
]
133202
}
134203
},
135204
"/accounts/whoami": {
@@ -245,6 +314,33 @@ exports[`e2e:app > GET / > should respond with api documentation (json) 1`] = `
245314
"uid"
246315
]
247316
},
317+
"AccountPayload": {
318+
"type": "object",
319+
"properties": {
320+
"email": {
321+
"type": "string",
322+
"description": "primary email address",
323+
"format": "email"
324+
},
325+
"type": {
326+
"type": "string",
327+
"description": "account type",
328+
"enum": [
329+
"developer",
330+
"user"
331+
]
332+
},
333+
"uid": {
334+
"type": "string",
335+
"description": "unique account id"
336+
}
337+
},
338+
"required": [
339+
"email",
340+
"type",
341+
"uid"
342+
]
343+
},
248344
"CreateAccountCommand": {
249345
"type": "object",
250346
"properties": {

0 commit comments

Comments
 (0)