-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathopenapi.yaml
More file actions
3206 lines (3166 loc) · 96.4 KB
/
openapi.yaml
File metadata and controls
3206 lines (3166 loc) · 96.4 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
openapi: 3.1.0
info:
title: Dearly API
summary: Dearly makes connecting with loved ones easy.
description: |
Dearly is a private family-sharing app that bridges generational gaps and makes staying connected easier and more meaningful. The platform allows families to share photos, voice memos, and other media in a secure, invite-only space. With two thoughtfully designed modes, Dearly caters to every generation: a streamlined, user-friendly interface for those less familiar with technology and a dynamic, feature-rich experience for younger users.
version: 1.0.0
components:
securitySchemes:
BearerAuth:
type: http
scheme: bearer
bearerFormat: JWT
schemas:
Error:
type: object
required:
- error
properties:
error:
type: string
ValidationError:
type: object
required:
- message
- errors
properties:
message:
type: string
errors:
type: array
items:
type: object
required:
- path
- message
properties:
path:
type: string
message:
type: string
User:
type: object
properties:
name:
type: string
description: Display name of the user.
username:
type: string
description: The username of the user.
id:
type: string
format: uuid
example: 5e91507e-5630-4efd-9fd4-799178870b10
description: A unique identifier for the user.
mode:
type: string
enum: ["BASIC", "ADVANCED", null]
description: The mode for the user (e.g., "BASIC" or "ADVANCED"). Default to "BASIC" if no mode is provided.
profilePhoto:
type: string
nullable: true
description: A URL to the user's profile photo.
bio:
type: string
nullable: true
description: A bio for the user's profile.
birthday:
type: string
format: date
nullable: true
description: Birthday of the user.
timezone:
type: string
nullable: true
description: Timezone that user is in for sending nudges.
postCount:
type: number
nullable: true
description: Number of posts that a user made.
required:
- username
- mode
ThumbnailResponse:
type: object
properties:
month:
type: integer
description: The month of the post.
example: 1
year:
type: integer
description: The year of the post.
example: 2025
data:
type: array
items:
type: object
properties:
day:
type: integer
description: The day of the month when the post received likes.
example: 23
url:
type: string
description: URL of the thumbnail image.
example: "https://example.com/thumbnail.jpg"
description: A list of thumbnails for the specified month/year.
Thumbnail:
type: object
properties:
date:
type: integer
description: The day of the month the post received likes.
example: 23
url:
type: string
description: URL to the thumbnail image.
example: "https://example.com/thumbnail.jpg"
required:
- date
- url
SearchedUser:
type: object
properties:
id:
type: string
format: uuid
example: 5e91507e-5630-4efd-9fd4-799178870b10
description: A unique identifier for the user.
name:
type: string
example: Garrett Ladley
description: Display name of user.
username:
type: string
example: garrettladley
description: Username of user.
profilePhoto:
type: string
description: Profile photo url of user.
nullable: true
role:
type: string
enum: ["MEMBER", "MANAGER"]
nullable: true
description: Defines the role and level of permissions this user in the group has.
lastNudgedAt:
type: string
format: date-time
example: "2025-01-17T00:00:00Z"
nullable: true
description: The date and time when the member was last nudged.
required:
- id
- name
- username
Group:
type: object
properties:
name:
type: string
description: The name of the group.
description:
type: string
description: A description of the group.
nullable: true
id:
type: string
format: uuid
example: 5e91507e-5630-4efd-9fd4-799178870b10
description: A unique identifier for the group.
managerId:
type: string
format: uuid
example: 5e91507e-5630-4efd-9fd4-799178870b10
description: A unique identifier of the group manager.
required:
- name
Member:
type: object
properties:
groupId:
type: string
format: uuid
example: 5e91507e-5630-4efd-9fd4-799178870b10
description: A unique identifier for the group.
userId:
type: string
format: uuid
example: 5e91507e-5630-4efd-9fd4-799178870b10
description: A unique identifier for the user in this group.
nudgeNotificationEnabled:
type: boolean
example: true
description: Return true if user has notification for nudge turned off.
postNotificationEnabled:
type: boolean
example: true
description: Return true if user has notification for post turned off.
commentNotificationEnabled:
type: boolean
example: true
description: Return true if user has notification for comment turned off.
likeNotificationEnabled:
type: boolean
example: true
description: Return true if user has notification for like turned off.
joinedAt:
type: string
format: date-time
example: "2025-01-17T00:00:00Z"
description: The date and time when the member was added.
role:
type: string
enum: ["MEMBER", "MANAGER", null]
description: Defines the role and level of permissions this user in the group has.
Post:
type: object
properties:
id:
type: string
format: uuid
example: 5e91507e-5630-4efd-9fd4-799178870b10
description: A unique identifier for the post.
groupId:
type: string
format: uuid
example: 5e91507e-5630-4efd-9fd4-799178870b10
description: A unique identifier for the group.
userId:
type: string
format: uuid
example: 5e91507e-5630-4efd-9fd4-799178870b10
description: A unique identifier for the user who makes the post.
createdAt:
type: string
format: date-time
example: "2025-01-17T00:00:00Z"
description: The date and time when the post was created.
caption:
type: string
example: "This is a sample caption for the post."
description: A textual description or caption for the post.
nullable: true
name:
type: string
description: Display name of user who makes the post.
nullable: true
username:
type: string
description: Username of user who makes the post.
likes:
type: number
example: 20
description: Number of likes in a post
comments:
type: number
example: 20
description: Number of comments in a post
isLiked:
type: boolean
example: true
description: Return true if user liked the post
profilePhoto:
type: string
nullable: true
description: Profile photo url of user who made the post
location:
type: string
description: Location of where the post is made
example: "home"
nullable: true
media:
type: array
items:
$ref: "#/components/schemas/Media"
description: A list of media items attached to the post.
PostWithURL:
type: object
properties:
id:
type: string
format: uuid
example: 5e91507e-5630-4efd-9fd4-799178870b10
description: A unique identifier for the post.
groupId:
type: string
format: uuid
example: 5e91507e-5630-4efd-9fd4-799178870b10
description: A unique identifier for the group.
userId:
type: string
format: uuid
example: 5e91507e-5630-4efd-9fd4-799178870b10
description: A unique identifier for the user who makes the post.
createdAt:
type: string
format: date-time
example: "2025-01-17T00:00:00Z"
description: The date and time when the post was created.
caption:
type: string
example: "This is a sample caption for the post."
description: A textual description or caption for the post.
nullable: true
likes:
type: number
example: 20
description: Number of likes in a post
comments:
type: number
example: 20
description: Number of comments in a post
isLiked:
type: boolean
example: true
description: Return true if user liked the post
profilePhoto:
type: string
nullable: true
description: Profile photo url of user who made the post
name:
type: string
nullable: true
description: Display name of user who made the post
username:
type: string
description: Username of user who made the post
location:
type: string
description: Location of where the post is made
example: "home"
nullable: true
media:
type: array
items:
$ref: "#/components/schemas/MediaWithURL"
description: A list of media items attached to the post.
MediaUpload:
type: object
properties:
type:
type: string
example: "PHOTO"
enum:
- PHOTO
- VIDEO
- AUDIO
description: The type of the media (e.g., photo, audio, video)
objectKey:
type: string
format: uuid
example: 5e91507e-5630-4efd-9fd4-799178870b10
description: The unique object key associated with the media in S3
Media:
type: object
properties:
id:
type: string
format: uuid
example: 5e91507e-5630-4efd-9fd4-799178870b11
description: A unique identifier for the media item.
postId:
type: string
format: uuid
example: 5e91507e-5630-4efd-9fd4-799178870b10
description: The ID of the post to which the media belongs.
objectKey:
type: string
format: uuid
example: 5e91507e-5630-4efd-9fd4-799178870b10
description: The unique object key associated with the media in S3.
type:
type: string
example: "PHOTO"
enum:
- PHOTO
- VIDEO
- AUDIO
description: The type of the media (e.g., photo, audio, video).
Comment:
type: object
properties:
id:
type: string
format: uuid
example: 5e91507e-5630-4efd-9fd4-799178870b11
description: A unique identifier for the comment item.
postId:
type: string
format: uuid
example: 5e91507e-5630-4efd-9fd4-799178870b10
description: The ID of the post to which the comment belongs.
userId:
type: string
format: uuid
example: 5e91507e-5630-4efd-9fd4-799178870b10
description: The ID of the user to which the comment belongs.
voiceMemo:
type: string
format: uuid
example: 5e91507e-5630-4efd-9fd4-799178870b10
description: The unique object key associated with the audio in S3.
nullable: true
content:
type: string
minLength: 1
maxLength: 500
description: the text being commented
nullable: true
createdAt:
type: string
format: date-time
example: "2025-01-17T00:00:00Z"
description: The date and time when the post was created.
CommentWithURL:
type: object
properties:
id:
type: string
format: uuid
example: 5e91507e-5630-4efd-9fd4-799178870b11
description: A unique identifier for the comment item.
postId:
type: string
format: uuid
example: 5e91507e-5630-4efd-9fd4-799178870b10
description: The ID of the post to which the comment belongs.
userId:
type: string
format: uuid
example: 5e91507e-5630-4efd-9fd4-799178870b10
description: The ID of the user to which the comment belongs.
voiceMemo:
type: string
description: The pre-signed url from AWS S3
nullable: true
content:
type: string
minLength: 1
maxLength: 500
description: The text being commented
nullable: true
profilePhoto:
type: string
description: Profile photo of user that posted comment
nullable: true
username:
type: string
description: Username of user that posted comment
nullable: true
createdAt:
type: string
format: date-time
example: "2025-01-17T00:00:00Z"
description: The date and time when the post was created.
MediaWithURL:
type: object
properties:
id:
type: string
format: uuid
example: 5e91507e-5630-4efd-9fd4-799178870b11
description: A unique identifier for the media item.
postId:
type: string
format: uuid
example: 5e91507e-5630-4efd-9fd4-799178870b10
description: The ID of the post to which the media belongs.
url:
type: string
format: uuid
description: The pre-signed URL from AWS S3
type:
type: string
example: "PHOTO"
enum:
- PHOTO
- VIDEO
- AUDIO
description: The type of the media (e.g., photo, audio, video).
Notification:
type: object
properties:
id:
type: string
format: uuid
example: 5e91507e-5630-4efd-9fd4-799178870b10
description: The ID of the specific notification delivered to a user.
actorId:
type: string
format: uuid
example: 5e91507e-5630-4efd-9fd4-799178870b10
description: The ID of the user that performed an action onto the current user.
receiverId:
type: string
format: uuid
example: 5e91507e-5630-4efd-9fd4-799178870b10
description: The ID of the user that receives the notification.
referenceType:
type: string
example: "POST"
enum: ["POST", "COMMENT", "LIKE", "NUDGE", "LIKE-COMMENT"]
description: The type of notification that occurred, either a new post or an interaction with user media.
postId:
type: string
format: uuid
example: 5e91507e-5630-4efd-9fd4-799178870b10
description: The ID of the post that the notification is associated with.
nullable: true
commentId:
type: string
format: uuid
example: 5e91507e-5630-4efd-9fd4-799178870b10
description: The ID of the comment that the notification is associated with.
nullable: true
likeId:
type: string
format: uuid
example: 5e91507e-5630-4efd-9fd-9fd4-799178870b10
description: The ID of the like that the notification is associated with.
nullable: true
title:
type: string
maxLength: 100
description: The header text of a notification.
example: "New post from Mom"
description:
type: string
maxLength: 300
description: The body text of a notification.
example: "Mom liked your post."
mediaURL:
type: string
description: The URL of the media associated with the notification.
profilePhoto:
type: string
description: The URL of user's profile photo associated with the notification.
nullable: true
createdAt:
type: string
format: date-time
example: "2025-01-17T00:00:00Z"
description: The date and time when the notification was created.
required:
- actorId
- receiverId
- referenceType
- title
- createdAt
- mediaURL
- postId
oneOf:
- required:
- postId
- required:
- commentId
- required:
- likeId
Schedule:
type: object
properties:
id:
type: string
format: uuid
description: ID of nudge schedule
example: "3a6e07ab-9b7b-4e0d-b10f-c7fe945f8476"
groupId:
type: string
format: uuid
description: ID of group
example: "d0c41d3f-dc80-4a62-a3b2-6e057c0f9981"
frequency:
type: string
description: Frequency of nudge
enum:
- DAILY
- WEEKLY
- BIWEEKLY
- MONTHLY
- YEARLY
daysOfWeek:
type: array
nullable: true
description: Days of week to send nudge (use with WEEKLY/BIWEEKLY)
items:
type: string
enum:
- MON
- TUE
- WED
- THU
- FRI
- SAT
- SUN
day:
type: integer
description: Day to send nudge (use with MONTHLY/YEARLY)
minimum: 1
maximum: 31
nullable: true
month:
type: integer
description: Month to send nudge (use with YEARLY)
minimum: 1
maximum: 12
nullable: true
nudgeAt:
type: string
format: date-time
description: Time with timezone to send nudge
example: "2025-02-16T08:30:00+00:00"
isActive:
type: boolean
default: true
description: Status of nudge (active or inactive)
createdAt:
type: string
format: date-time
description: Time when nudge schedule is initialized
example: "2025-02-16T08:30:00Z"
updatedAt:
type: string
format: date-time
description: Time when nudge schedule is updated
example: "2025-02-16T08:30:00Z"
required:
- frequency
- nudgeAt
WaveForm:
type: object
properties:
length:
type: integer
description: length of the audio message
data:
type: array
items:
type: integer
description: the db level at time (index * 500 ms)
description: The db levels of the given media
paths:
/healthcheck:
get:
tags:
- Healthcheck
summary: Healthcheck endpoint
description: Pings the server to check the health of the current server
responses:
200:
description: Success!
content:
application/json:
schema:
type: object
properties:
message:
type: string
enum:
- OK
/api/v1/users:
post:
tags:
- User Endpoints
summary: Creates a user
description: Creates a user from the specified body (with ID being the decoded ID from JWT).
security:
- BearerAuth: []
requestBody:
required: true
content:
application/json:
schema:
type: object
properties:
name:
type: string
minLength: 1
maxLength: 100
description: Display name of the user.
username:
type: string
minLength: 1
maxLength: 100
description: The username of the user.
mode:
type: string
enum: ["BASIC", "ADVANCED", null]
description: The mode for the user (e.g., "BASIC" or "ADVANCED").
profilePhoto:
type: string
nullable: true
description: A URL to the user's profile photo.
required:
- username
additionalProperties: true
responses:
201:
description: Successfully created a user
content:
application/json:
schema:
$ref: "#/components/schemas/User"
400:
description: Malformed request
content:
application/json:
schema:
oneOf:
- $ref: "#/components/schemas/Error"
- $ref: "#/components/schemas/ValidationError"
401:
description: Unauthorized due to invalid JWT
content:
application/json:
schema:
$ref: "#/components/schemas/Error"
409:
description: Same JWT creates multiple users or username already exists
content:
application/json:
schema:
$ref: "#/components/schemas/Error"
500:
description: Internal server error
content:
application/json:
schema:
$ref: "#/components/schemas/Error"
/api/v1/users/{id}:
get:
tags:
- User Endpoints
summary: Gets a user
description: Gets the user by their UUID.
parameters:
- name: id
in: path
description: ID of the user to get
required: true
schema:
type: string
format: uuid
example: 5e91507e-5630-4efd-9fd4-799178870b10
responses:
200:
description: Successfully retrieved a User
content:
application/json:
schema:
$ref: "#/components/schemas/User"
400:
description: Malformed request
content:
application/json:
schema:
oneOf:
- $ref: "#/components/schemas/Error"
- $ref: "#/components/schemas/ValidationError"
401:
description: Unauthorized due to invalid JWT
content:
application/json:
schema:
$ref: "#/components/schemas/Error"
404:
description: User not found
content:
application/json:
schema:
$ref: "#/components/schemas/Error"
500:
description: Internal server error
content:
application/json:
schema:
$ref: "#/components/schemas/Error"
/api/v1/users/me:
patch:
tags:
- User Endpoints
summary: Updates a user
description: Updates the user profile for the currently authenticated user (identified by the decoded ID from JWT).
security:
- BearerAuth: []
requestBody:
required: true
content:
application/json:
schema:
type: object
properties:
name:
type: string
minLength: 1
description: Display name of the user.
username:
type: string
minLength: 1
description: The username of the user.
mode:
type: string
enum: ["BASIC", "ADVANCED", null]
description: The mode for the user (e.g., "BASIC" or "ADVANCED").
profilePhoto:
type: string
nullable: true
description: A URL to the user's profile photo.
notificationsEnabled:
type: boolean
description: True when user wants to receive notifications.
additionalProperties: true
responses:
200:
description: Successfully updated the user profile
content:
application/json:
schema:
$ref: "#/components/schemas/User"
400:
description: Malformed request
content:
application/json:
schema:
oneOf:
- $ref: "#/components/schemas/Error"
- $ref: "#/components/schemas/ValidationError"
401:
description: Unauthorized due to invalid JWT
content:
application/json:
schema:
$ref: "#/components/schemas/Error"
404:
description: User not found
content:
application/json:
schema:
$ref: "#/components/schemas/Error"
500:
description: Internal server error
content:
application/json:
schema:
$ref: "#/components/schemas/Error"
delete:
tags:
- User Endpoints
summary: Deletes a user
description: Deletes the user account for the currently authenticated user (identified by the decoded ID from JWT).
security:
- BearerAuth: []
responses:
200:
description: Successfully delete user
content:
application/json:
schema:
type: object
properties:
message:
type: string
example: "Successfully delete user"
400:
description: Malformed request
content:
application/json:
schema:
$ref: "#/components/schemas/ValidationError"
401:
description: Unauthorized due to invalid JWT
content:
application/json:
schema:
$ref: "#/components/schemas/Error"
500:
description: Internal server error
content:
application/json:
schema:
$ref: "#/components/schemas/Error"
/api/v1/users/groups:
get:
tags:
- User Endpoints
summary: Gets all groups for user
description: Gets all groups user is member of.
security:
- BearerAuth: []
parameters:
- name: limit
in: query
description: The maximum number of groups to return.
required: false
schema:
type: integer
default: 10
- name: page
in: query
description: The page number for pagination.
required: false
schema:
type: integer
default: 1
responses:
200:
description: Successfully retrieve groups user is part of
content:
application/json:
schema:
type: array
items:
$ref: "#/components/schemas/Group"
400:
description: Malformed query params
content:
application/json:
schema:
$ref: "#/components/schemas/ValidationError"
401:
description: Unauthorized due to invalid JWT
content:
application/json:
schema:
$ref: "#/components/schemas/Error"
500:
description: Internal server error
content:
application/json:
schema:
$ref: "#/components/schemas/Error"
/api/v1/users/devices:
post:
tags:
- User Endpoints
summary: Registers user's device token
description: Registers an Expo Device Token for the currently authenticated user to receive notifications.
security:
- BearerAuth: []
requestBody:
content:
application/json:
schema:
type: object
properties:
expoToken:
type: string
description: The Expo Device Token of the user.
required:
- expoToken
responses:
200:
description: Successfully registered the device token
content:
application/json:
schema:
type: array
items:
type: string
description: Array of user's device tokens
400:
description: Malformed request
content:
application/json:
schema:
oneOf:
- $ref: "#/components/schemas/Error"
- $ref: "#/components/schemas/ValidationError"
401:
description: Unauthorized due to invalid JWT
content:
application/json:
schema:
$ref: "#/components/schemas/Error"
404:
description: User not found
content:
application/json:
schema:
$ref: "#/components/schemas/Error"
500:
description: Internal server error
content:
application/json:
schema: