Skip to content

Commit ec6d952

Browse files
authored
feat: add goals (#908)
1 parent e567aeb commit ec6d952

File tree

19 files changed

+2634
-10
lines changed

19 files changed

+2634
-10
lines changed

api/docs.go

Lines changed: 533 additions & 0 deletions
Large diffs are not rendered by default.

api/swagger.json

Lines changed: 533 additions & 0 deletions
Large diffs are not rendered by default.

api/swagger.yaml

Lines changed: 372 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1043,6 +1043,132 @@ definitions:
10431043
example: "2022-04-17T20:14:01.048145Z"
10441044
type: string
10451045
type: object
1046+
controllers.GoalCreateResponseV3:
1047+
properties:
1048+
data:
1049+
description: List of created resources
1050+
items:
1051+
$ref: '#/definitions/controllers.GoalResponseV3'
1052+
type: array
1053+
error:
1054+
description: The error, if any occurred
1055+
example: the specified resource ID is not a valid UUID
1056+
type: string
1057+
type: object
1058+
controllers.GoalListResponseV3:
1059+
properties:
1060+
data:
1061+
description: List of resources
1062+
items:
1063+
$ref: '#/definitions/controllers.GoalV3'
1064+
type: array
1065+
error:
1066+
description: The error, if any occurred
1067+
example: the specified resource ID is not a valid UUID
1068+
type: string
1069+
pagination:
1070+
allOf:
1071+
- $ref: '#/definitions/controllers.Pagination'
1072+
description: Pagination information
1073+
type: object
1074+
controllers.GoalResponseV3:
1075+
properties:
1076+
data:
1077+
allOf:
1078+
- $ref: '#/definitions/controllers.GoalV3'
1079+
description: The resource
1080+
error:
1081+
description: The error, if any occurred
1082+
example: the specified resource ID is not a valid UUID
1083+
type: string
1084+
type: object
1085+
controllers.GoalV3:
1086+
properties:
1087+
amount:
1088+
default: 0
1089+
description: How much money should be saved for this goal?
1090+
example: 127
1091+
type: number
1092+
archived:
1093+
default: false
1094+
description: If this goal is still in use or not
1095+
example: true
1096+
type: boolean
1097+
createdAt:
1098+
description: Time the resource was created
1099+
example: "2022-04-02T19:28:44.491514Z"
1100+
type: string
1101+
deletedAt:
1102+
description: Time the resource was marked as deleted
1103+
example: "2022-04-22T21:01:05.058161Z"
1104+
type: string
1105+
envelopeId:
1106+
description: The ID of the envelope this goal is for
1107+
example: f81566d9-af4d-4f13-9830-c62c4b5e4c7e
1108+
type: string
1109+
id:
1110+
description: UUID for the resource
1111+
example: 65392deb-5e92-4268-b114-297faad6cdce
1112+
type: string
1113+
links:
1114+
$ref: '#/definitions/controllers.GoalV3Links'
1115+
month:
1116+
description: The month the balance of the envelope should be the set amount
1117+
example: "2024-07-01T00:00:00.000000Z"
1118+
type: string
1119+
name:
1120+
description: Name of the goal
1121+
example: New TV
1122+
type: string
1123+
note:
1124+
description: Note about the goal
1125+
example: We want to replace the old CRT TV soon-ish
1126+
type: string
1127+
updatedAt:
1128+
description: Last time the resource was updated
1129+
example: "2022-04-17T20:14:01.048145Z"
1130+
type: string
1131+
type: object
1132+
controllers.GoalV3Editable:
1133+
properties:
1134+
amount:
1135+
default: 0
1136+
description: How much money should be saved for this goal?
1137+
example: 127
1138+
type: number
1139+
archived:
1140+
default: false
1141+
description: If this goal is still in use or not
1142+
example: true
1143+
type: boolean
1144+
envelopeId:
1145+
description: The ID of the envelope this goal is for
1146+
example: f81566d9-af4d-4f13-9830-c62c4b5e4c7e
1147+
type: string
1148+
month:
1149+
description: The month the balance of the envelope should be the set amount
1150+
example: "2024-07-01T00:00:00.000000Z"
1151+
type: string
1152+
name:
1153+
description: Name of the goal
1154+
example: New TV
1155+
type: string
1156+
note:
1157+
description: Note about the goal
1158+
example: We want to replace the old CRT TV soon-ish
1159+
type: string
1160+
type: object
1161+
controllers.GoalV3Links:
1162+
properties:
1163+
envelope:
1164+
description: The Envelope this goal references
1165+
example: https://example.com/api/v3/envelopes/c1a96ae4-80e3-4827-8ed0-c7656f224fee
1166+
type: string
1167+
self:
1168+
description: The Goal itself
1169+
example: https://example.com/api/v3/goals/438cc6c0-9baf-49fd-a75a-d76bd5cab19c
1170+
type: string
1171+
type: object
10461172
controllers.ImportPreviewList:
10471173
properties:
10481174
data:
@@ -2450,6 +2576,10 @@ definitions:
24502576
description: URL of Envelope collection endpoint
24512577
example: https://example.com/api/v3/envelopes
24522578
type: string
2579+
goals:
2580+
description: URL of goal collection endpoint
2581+
example: https://example.com/api/v3/goals
2582+
type: string
24532583
import:
24542584
description: URL of import list endpoint
24552585
example: https://example.com/api/v3/import
@@ -6136,6 +6266,248 @@ paths:
61366266
summary: Update MonthConfig
61376267
tags:
61386268
- Envelopes
6269+
/v3/goals:
6270+
get:
6271+
description: Returns a list of goals
6272+
parameters:
6273+
- description: Filter by name
6274+
in: query
6275+
name: name
6276+
type: string
6277+
- description: Filter by note
6278+
in: query
6279+
name: note
6280+
type: string
6281+
- description: Search for this text in name and note
6282+
in: query
6283+
name: search
6284+
type: string
6285+
- description: Is the goal archived?
6286+
in: query
6287+
name: archived
6288+
type: boolean
6289+
- description: Filter by envelope ID
6290+
in: query
6291+
name: envelope
6292+
type: string
6293+
- description: Month of the goal. Ignores exact time, matches on the month of
6294+
the RFC3339 timestamp provided.
6295+
in: query
6296+
name: month
6297+
type: string
6298+
- description: Goals for this and later months. Ignores exact time, matches
6299+
on the month of the RFC3339 timestamp provided.
6300+
in: query
6301+
name: fromMonth
6302+
type: string
6303+
- description: Goals for this and earlier months. Ignores exact time, matches
6304+
on the month of the RFC3339 timestamp provided.
6305+
in: query
6306+
name: untilMonth
6307+
type: string
6308+
- description: Filter by amount
6309+
in: query
6310+
name: amount
6311+
type: string
6312+
- description: Amount less than or equal to this
6313+
in: query
6314+
name: amountLessOrEqual
6315+
type: string
6316+
- description: Amount more than or equal to this
6317+
in: query
6318+
name: amountMoreOrEqual
6319+
type: string
6320+
- description: The offset of the first goal returned. Defaults to 0.
6321+
in: query
6322+
name: offset
6323+
type: integer
6324+
- description: Maximum number of goal to return. Defaults to 50.
6325+
in: query
6326+
name: limit
6327+
type: integer
6328+
produces:
6329+
- application/json
6330+
responses:
6331+
"200":
6332+
description: OK
6333+
schema:
6334+
$ref: '#/definitions/controllers.GoalListResponseV3'
6335+
"400":
6336+
description: Bad Request
6337+
schema:
6338+
$ref: '#/definitions/controllers.GoalListResponseV3'
6339+
"500":
6340+
description: Internal Server Error
6341+
schema:
6342+
$ref: '#/definitions/controllers.GoalListResponseV3'
6343+
summary: Get goals
6344+
tags:
6345+
- Goals
6346+
options:
6347+
description: Returns an empty response with the HTTP Header "allow" set to the
6348+
allowed HTTP verbs
6349+
responses:
6350+
"204":
6351+
description: No Content
6352+
summary: Allowed HTTP verbs
6353+
tags:
6354+
- Goals
6355+
post:
6356+
description: Creates new goals
6357+
parameters:
6358+
- description: Goals
6359+
in: body
6360+
name: goals
6361+
required: true
6362+
schema:
6363+
items:
6364+
$ref: '#/definitions/controllers.GoalV3Editable'
6365+
type: array
6366+
produces:
6367+
- application/json
6368+
responses:
6369+
"201":
6370+
description: Created
6371+
schema:
6372+
$ref: '#/definitions/controllers.GoalCreateResponseV3'
6373+
"400":
6374+
description: Bad Request
6375+
schema:
6376+
$ref: '#/definitions/controllers.GoalCreateResponseV3'
6377+
"404":
6378+
description: Not Found
6379+
schema:
6380+
$ref: '#/definitions/controllers.GoalCreateResponseV3'
6381+
"500":
6382+
description: Internal Server Error
6383+
schema:
6384+
$ref: '#/definitions/controllers.GoalCreateResponseV3'
6385+
summary: Create goals
6386+
tags:
6387+
- Goals
6388+
/v3/goals/{id}:
6389+
delete:
6390+
description: Deletes a goal
6391+
parameters:
6392+
- description: ID formatted as string
6393+
in: path
6394+
name: id
6395+
required: true
6396+
type: string
6397+
responses:
6398+
"204":
6399+
description: No Content
6400+
"400":
6401+
description: Bad Request
6402+
schema:
6403+
$ref: '#/definitions/httperrors.HTTPError'
6404+
"404":
6405+
description: Not Found
6406+
schema:
6407+
$ref: '#/definitions/httperrors.HTTPError'
6408+
"500":
6409+
description: Internal Server Error
6410+
schema:
6411+
$ref: '#/definitions/httperrors.HTTPError'
6412+
summary: Delete goal
6413+
tags:
6414+
- Goals
6415+
get:
6416+
description: Returns a specific goal
6417+
parameters:
6418+
- description: ID formatted as string
6419+
in: path
6420+
name: id
6421+
required: true
6422+
type: string
6423+
produces:
6424+
- application/json
6425+
responses:
6426+
"200":
6427+
description: OK
6428+
schema:
6429+
$ref: '#/definitions/controllers.GoalResponseV3'
6430+
"400":
6431+
description: Bad Request
6432+
schema:
6433+
$ref: '#/definitions/controllers.GoalResponseV3'
6434+
"404":
6435+
description: Not Found
6436+
schema:
6437+
$ref: '#/definitions/controllers.GoalResponseV3'
6438+
"500":
6439+
description: Internal Server Error
6440+
schema:
6441+
$ref: '#/definitions/controllers.GoalResponseV3'
6442+
summary: Get goal
6443+
tags:
6444+
- Goals
6445+
options:
6446+
description: Returns an empty response with the HTTP Header "allow" set to the
6447+
allowed HTTP verbs
6448+
parameters:
6449+
- description: ID formatted as string
6450+
in: path
6451+
name: id
6452+
required: true
6453+
type: string
6454+
responses:
6455+
"204":
6456+
description: No Content
6457+
"400":
6458+
description: Bad Request
6459+
schema:
6460+
$ref: '#/definitions/httperrors.HTTPError'
6461+
"404":
6462+
description: Not Found
6463+
schema:
6464+
$ref: '#/definitions/httperrors.HTTPError'
6465+
"500":
6466+
description: Internal Server Error
6467+
schema:
6468+
$ref: '#/definitions/httperrors.HTTPError'
6469+
summary: Allowed HTTP verbs
6470+
tags:
6471+
- Goals
6472+
patch:
6473+
consumes:
6474+
- application/json
6475+
description: Updates an existing goal. Only values to be updated need to be
6476+
specified.
6477+
parameters:
6478+
- description: ID formatted as string
6479+
in: path
6480+
name: id
6481+
required: true
6482+
type: string
6483+
- description: Goal
6484+
in: body
6485+
name: goal
6486+
required: true
6487+
schema:
6488+
$ref: '#/definitions/controllers.GoalV3Editable'
6489+
produces:
6490+
- application/json
6491+
responses:
6492+
"200":
6493+
description: OK
6494+
schema:
6495+
$ref: '#/definitions/controllers.GoalResponseV3'
6496+
"400":
6497+
description: Bad Request
6498+
schema:
6499+
$ref: '#/definitions/controllers.GoalResponseV3'
6500+
"404":
6501+
description: Not Found
6502+
schema:
6503+
$ref: '#/definitions/controllers.GoalResponseV3'
6504+
"500":
6505+
description: Internal Server Error
6506+
schema:
6507+
$ref: '#/definitions/controllers.GoalResponseV3'
6508+
summary: Update goal
6509+
tags:
6510+
- Goals
61396511
/v3/import:
61406512
get:
61416513
description: Returns general information about the v3 API

0 commit comments

Comments
 (0)