forked from Shelterflex/monorepo
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathopenapi.yml
More file actions
5712 lines (5546 loc) · 172 KB
/
Copy pathopenapi.yml
File metadata and controls
5712 lines (5546 loc) · 172 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.0.3
info:
title: ShelterFlex Backend API
description: API for ShelterFlex backend service
version: 0.1.0
contact:
name: ShelterFlex Team
license:
name: MIT
url: https://opensource.org/licenses/MIT
servers:
- url: http://localhost:4000
description: Development server
- url: https://api.shelterflex.io
description: Production server
paths:
/health:
get:
summary: Health check endpoint
description: Returns the current health status and basic service information
operationId: getHealth
tags:
- Health
security: []
responses:
"200":
description: Service is healthy
content:
application/json:
schema:
type: object
required:
- status
- version
- uptimeSeconds
properties:
status:
type: string
enum: [ok]
example: ok
version:
type: string
example: "0.1.0"
uptimeSeconds:
type: number
format: int64
example: 3600
"429":
$ref: "#/components/responses/TooManyRequests"
default:
$ref: "#/components/responses/Error"
/api/auth/request-otp:
post:
summary: Request OTP for email login
description: Sends a one-time password (OTP) to the provided email address.
operationId: requestOtp
tags:
- Auth
security: []
requestBody:
required: true
content:
application/json:
schema:
type: object
required:
- email
properties:
email:
type: string
format: email
responses:
"200":
description: OTP request accepted
content:
application/json:
schema:
type: object
required:
- message
properties:
message:
type: string
example: OTP sent to your email
"429":
$ref: "#/components/responses/TooManyRequests"
default:
$ref: "#/components/responses/Error"
/api/auth/verify-otp:
post:
summary: Verify OTP and create session
description: Verifies the OTP for the email and returns a session token (Bearer).
operationId: verifyOtp
tags:
- Auth
security: []
requestBody:
required: true
content:
application/json:
schema:
type: object
required:
- email
- otp
properties:
email:
type: string
format: email
otp:
type: string
minLength: 6
maxLength: 6
responses:
"200":
description: OTP verified successfully
content:
application/json:
schema:
type: object
required:
- token
- user
properties:
token:
type: string
description: "Session token to be used as Authorization: Bearer <token>"
user:
$ref: "#/components/schemas/User"
"400":
$ref: "#/components/responses/ValidationError"
default:
$ref: "#/components/responses/Error"
/api/auth/logout:
post:
summary: Logout
description: Invalidates the current session token.
operationId: logout
tags:
- Auth
security:
- bearerAuth: []
responses:
"200":
description: Logged out successfully
content:
application/json:
schema:
type: object
required:
- message
properties:
message:
type: string
example: Logged out
"401":
$ref: "#/components/responses/Unauthorized"
default:
$ref: "#/components/responses/Error"
/api/auth/me:
get:
summary: Get current authenticated user
description: Returns the current user associated with the Bearer session token.
operationId: getMe
tags:
- Auth
security:
- bearerAuth: []
responses:
"200":
description: Current user
content:
application/json:
schema:
type: object
required:
- user
properties:
user:
$ref: "#/components/schemas/User"
"401":
$ref: "#/components/responses/Unauthorized"
default:
$ref: "#/components/responses/Error"
/api/v1/user/preferences/notifications/messages-email:
patch:
summary: Update message email preference
description: Opt in or out of delayed message email notifications.
operationId: updateMessageEmailPreference
tags:
- User Preferences
security:
- bearerAuth: []
requestBody:
required: true
content:
application/json:
schema:
type: object
required:
- enabled
properties:
enabled:
type: boolean
responses:
"200":
description: Preference updated
content:
application/json:
schema:
type: object
required:
- messageEmailsEnabled
properties:
messageEmailsEnabled:
type: boolean
"401":
$ref: "#/components/responses/Unauthorized"
default:
$ref: "#/components/responses/Error"
/api/auth/wallet/challenge:
post:
summary: Create wallet login challenge
description: Returns a Stellar SEP-10 style challenge XDR for the wallet to sign.
operationId: walletChallenge
tags:
- Auth
security: []
requestBody:
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/WalletChallengeRequest'
responses:
"200":
description: Challenge created
content:
application/json:
schema:
$ref: '#/components/schemas/WalletChallengeResponse'
"400":
$ref: "#/components/responses/ValidationError"
default:
$ref: "#/components/responses/Error"
/api/auth/wallet/verify:
post:
summary: Verify wallet login signature
description: Verifies a signed challenge XDR and creates a session token.
operationId: walletVerify
tags:
- Auth
security: []
requestBody:
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/WalletVerifyRequest'
responses:
"200":
description: Wallet verified
content:
application/json:
schema:
$ref: '#/components/schemas/AuthTokenResponse'
"400":
$ref: "#/components/responses/ValidationError"
default:
$ref: "#/components/responses/Error"
/api/risk/state:
get:
summary: Get current user risk state
description: Returns whether the authenticated user is frozen and any freeze reason.
operationId: getRiskState
tags:
- Risk
security:
- bearerAuth: []
responses:
"200":
description: Risk state
content:
application/json:
schema:
$ref: '#/components/schemas/RiskStateResponse'
"401":
$ref: "#/components/responses/Unauthorized"
default:
$ref: "#/components/responses/Error"
/api/admin/jobs/health:
get:
summary: Scheduled job and worker health
description: >-
Health of every scheduled job and background worker: what it does, when
it last ran, how long that run took, how many records it processed, and
whether it is overdue. A job that has stopped being scheduled reports
state "overdue" (or "never_ran") so a missing run is detectable as an
absence rather than only as an error. Requires the x-admin-secret header
when MANUAL_ADMIN_SECRET is configured.
operationId: getJobHealth
tags:
- Admin
security:
- adminSecret: []
responses:
"200":
description: Job health report
content:
application/json:
schema:
type: object
required: [capturedAt, overdueCount, failingCount, jobs]
properties:
capturedAt:
type: string
format: date-time
overdueCount:
type: integer
failingCount:
type: integer
jobs:
type: array
items:
type: object
required: [name, module, does, expectedIntervalMs, state, overdue]
properties:
name:
type: string
module:
type: string
does:
type: string
expectedIntervalMs:
type: integer
ifItDoesNotRun:
type: string
healthy:
type: string
state:
type: string
enum: [healthy, failing, overdue, never_ran]
overdue:
type: boolean
secondsSinceLastRun:
type: integer
nullable: true
lastSuccessAt:
type: string
format: date-time
nullable: true
consecutiveFailures:
type: integer
lastRun:
type: object
nullable: true
properties:
startedAt:
type: string
format: date-time
finishedAt:
type: string
format: date-time
durationMs:
type: integer
outcome:
type: string
enum: [completed, failed, skipped_overrun]
recordsProcessed:
type: integer
correlationId:
type: string
nullable: true
error:
type: string
"403":
description: Invalid admin secret
default:
$ref: "#/components/responses/Error"
/api/admin/receipts:
get:
summary: Query indexed receipts
description: >-
Query receipts indexed off-chain (no Soroban call). Note: despite the
/admin path prefix, this endpoint only requires an authenticated
session (authenticateToken) — the route handler does not check for an
admin role.
operationId: queryReceipts
tags:
- Admin
security:
- bearerAuth: []
parameters:
- name: dealId
in: query
required: false
schema:
type: string
- name: txType
in: query
required: false
schema:
type: string
- name: page
in: query
required: false
schema:
type: integer
minimum: 1
default: 1
- name: pageSize
in: query
required: false
schema:
type: integer
minimum: 1
maximum: 100
default: 20
responses:
"200":
description: Paged receipts
content:
application/json:
schema:
$ref: '#/components/schemas/PagedReceipts'
"401":
$ref: "#/components/responses/Unauthorized"
default:
$ref: "#/components/responses/Error"
/api/deals/{dealId}/receipts:
get:
summary: List receipts for a deal
description: >-
Returns all receipts for a deal. Note: the route has no auth
middleware today (see PR description — code/spec mismatch finding).
operationId: listDealReceipts
tags:
- Deals
security: []
parameters:
- name: dealId
in: path
required: true
schema:
type: string
responses:
"200":
description: Receipt list
content:
application/json:
schema:
$ref: '#/components/schemas/DealReceiptsResponse'
"404":
description: Deal not found
content:
application/json:
schema:
$ref: "#/components/schemas/Error"
default:
$ref: "#/components/responses/Error"
/api/support/messages:
post:
summary: Submit a public support inquiry
description: Accepts and stores a public contact/support message for later handling.
operationId: createSupportMessage
tags:
- Support
security: []
requestBody:
required: true
content:
application/json:
schema:
$ref: "#/components/schemas/CreateSupportMessageRequest"
responses:
"201":
description: Message accepted
content:
application/json:
schema:
$ref: "#/components/schemas/CreateSupportMessageResponse"
"400":
$ref: "#/components/responses/ValidationError"
default:
$ref: "#/components/responses/Error"
/api/whistleblower/ratings:
post:
summary: Submit a whistleblower rating (tenant)
description: Authenticated tenant submits a rating (1-5) and optional review text.
operationId: createWhistleblowerRating
tags:
- Whistleblower
security:
- bearerAuth: []
requestBody:
required: true
content:
application/json:
schema:
$ref: "#/components/schemas/CreateWhistleblowerRatingRequest"
responses:
"201":
description: Rating created
content:
application/json:
schema:
$ref: "#/components/schemas/CreateWhistleblowerRatingResponse"
"400":
$ref: "#/components/responses/ValidationError"
"409":
$ref: "#/components/responses/Error"
default:
$ref: "#/components/responses/Error"
/api/whistleblower/{id}/ratings:
get:
summary: List whistleblower ratings
description: Public list of ratings for profile/dashboard display.
operationId: listWhistleblowerRatings
tags:
- Whistleblower
security: []
parameters:
- name: id
in: path
required: true
schema:
type: string
- name: limit
in: query
required: false
schema:
type: integer
minimum: 1
maximum: 100
responses:
"200":
description: Ratings list
content:
application/json:
schema:
type: object
required: [success, ratings]
properties:
success:
type: boolean
ratings:
type: array
items:
$ref: "#/components/schemas/WhistleblowerRating"
"400":
$ref: "#/components/responses/ValidationError"
default:
$ref: "#/components/responses/Error"
/api/whistleblower/{id}/ratings/aggregate:
get:
summary: Get whistleblower rating aggregate
description: Public aggregate trust metrics (count, average, breakdown).
operationId: getWhistleblowerRatingAggregate
tags:
- Whistleblower
security: []
parameters:
- name: id
in: path
required: true
schema:
type: string
responses:
"200":
description: Aggregate metrics
content:
application/json:
schema:
type: object
required: [success, aggregate]
properties:
success:
type: boolean
aggregate:
$ref: "#/components/schemas/WhistleblowerRatingAggregate"
"400":
$ref: "#/components/responses/ValidationError"
default:
$ref: "#/components/responses/Error"
/api/epoch-rewards/stake:
post:
summary: Stake tokens in epoch rewards contract
description: Stake tokens to participate in epoch rewards program.
operationId: epochStake
tags:
- Epoch Rewards
security:
- bearerAuth: []
requestBody:
required: true
content:
application/json:
schema:
type: object
required: [amount]
properties:
amount:
type: string
description: Amount to stake as string (to handle large numbers)
example: "1000000"
responses:
"200":
description: Stake submitted successfully
content:
application/json:
schema:
type: object
required: [success, txHash]
properties:
success:
type: boolean
example: true
txHash:
type: string
description: Stellar transaction hash
example: "a3f2c1d4e5b6f7a8b9c0d1e2f3a4b5c6d7e8f9a0b1c2d3e4f5a6b7c8d9e0f1a2"
"400":
$ref: "#/components/responses/ValidationError"
"401":
$ref: "#/components/responses/Unauthorized"
default:
$ref: "#/components/responses/Error"
/api/epoch-rewards/unstake:
post:
summary: Unstake tokens from epoch rewards contract
description: Unstake previously staked tokens from epoch rewards program.
operationId: epochUnstake
tags:
- Epoch Rewards
security:
- bearerAuth: []
requestBody:
required: true
content:
application/json:
schema:
type: object
required: [amount]
properties:
amount:
type: string
description: Amount to unstake as string
example: "500000"
responses:
"200":
description: Unstake submitted successfully
content:
application/json:
schema:
type: object
required: [success, txHash]
properties:
success:
type: boolean
example: true
txHash:
type: string
description: Stellar transaction hash
example: "b4f3d2e5f6a8b9c0d1e2f3a4b5c6d7e8f9a0b1c2d3e4f5a6b7c8d9e0f1a2b3"
"400":
$ref: "#/components/responses/ValidationError"
"401":
$ref: "#/components/responses/Unauthorized"
default:
$ref: "#/components/responses/Error"
/api/epoch-rewards/claim:
post:
summary: Claim epoch rewards
description: Claim available rewards from the epoch rewards contract.
operationId: epochClaim
tags:
- Epoch Rewards
security:
- bearerAuth: []
responses:
"200":
description: Rewards claimed successfully
content:
application/json:
schema:
type: object
required: [success, claimedAmount]
properties:
success:
type: boolean
example: true
claimedAmount:
type: string
description: Amount claimed as string
example: "1000"
"400":
$ref: "#/components/responses/ValidationError"
"401":
$ref: "#/components/responses/Unauthorized"
default:
$ref: "#/components/responses/Error"
/api/epoch-rewards/claimable:
get:
summary: Get claimable rewards amount
description: Query the amount of rewards available to claim for the authenticated user.
operationId: epochGetClaimable
tags:
- Epoch Rewards
security:
- bearerAuth: []
responses:
"200":
description: Claimable amount retrieved successfully
content:
application/json:
schema:
type: object
required: [success, claimable]
properties:
success:
type: boolean
example: true
claimable:
type: string
description: Amount available to claim as string
example: "500"
"401":
$ref: "#/components/responses/Unauthorized"
default:
$ref: "#/components/responses/Error"
/api/epoch-rewards/epoch/{epochNumber}:
get:
summary: Get epoch information
description: Retrieve detailed information about a specific epoch.
operationId: epochGetEpoch
tags:
- Epoch Rewards
security:
- bearerAuth: []
parameters:
- name: epochNumber
in: path
required: true
schema:
type: integer
minimum: 1
description: The epoch number to query
responses:
"200":
description: Epoch information retrieved successfully
content:
application/json:
schema:
type: object
required: [success, data]
properties:
success:
type: boolean
example: true
data:
$ref: "#/components/schemas/EpochInfo"
"400":
$ref: "#/components/responses/ValidationError"
"401":
$ref: "#/components/responses/Unauthorized"
"404":
$ref: "#/components/responses/Error"
default:
$ref: "#/components/responses/Error"
/api/epoch-rewards/current-epoch:
get:
summary: Get current epoch number
description: Retrieve the current epoch number from the epoch rewards contract.
operationId: epochGetCurrentEpoch
tags:
- Epoch Rewards
security:
- bearerAuth: []
responses:
"200":
description: Current epoch number retrieved successfully
content:
application/json:
schema:
type: object
required: [success, currentEpoch]
properties:
success:
type: boolean
example: true
currentEpoch:
type: integer
description: Current epoch number
example: 1
"401":
$ref: "#/components/responses/Unauthorized"
default:
$ref: "#/components/responses/Error"
/api/epoch-rewards/total-staked:
get:
summary: Get total staked amount
description: Retrieve the total amount of tokens staked in the epoch rewards contract.
operationId: epochGetTotalStaked
tags:
- Epoch Rewards
security:
- bearerAuth: []
responses:
"200":
description: Total staked amount retrieved successfully
content:
application/json:
schema:
type: object
required: [success, totalStaked]
properties:
success:
type: boolean
example: true
totalStaked:
type: string
description: Total staked amount as string
example: "1000000"
"401":
$ref: "#/components/responses/Unauthorized"
default:
$ref: "#/components/responses/Error"
/api/property-issue-reports:
post:
summary: Submit a property issue report
description: Accepts and stores an issue report from the property detail report dialog.
operationId: createPropertyIssueReport
tags:
- Risk
security: []
requestBody:
required: true
content:
application/json:
schema:
$ref: "#/components/schemas/CreatePropertyIssueReportRequest"
responses:
"201":
description: Report accepted
content:
application/json:
schema:
$ref: "#/components/schemas/CreatePropertyIssueReportResponse"
"400":
$ref: "#/components/responses/ValidationError"
default:
$ref: "#/components/responses/Error"
/soroban/config:
get:
summary: Get Soroban configuration
description: Returns the current Soroban blockchain configuration
operationId: getSorobanConfig
tags:
- Soroban
security: []
responses:
"200":
description: Soroban configuration retrieved successfully
content:
application/json:
schema:
type: object
required:
- rpcUrl
- networkPassphrase
- contractId
properties:
rpcUrl:
type: string
format: uri
example: "https://soroban-testnet.stellar.org"
networkPassphrase:
type: string
example: "Test SDF Network ; September 2015"
contractId:
type: string
nullable: true
example: null
"429":
$ref: "#/components/responses/TooManyRequests"
default:
$ref: "#/components/responses/Error"
/api/whistleblower/{id}/earnings:
get:
summary: Get whistleblower earnings
description: Returns aggregated earnings totals and detailed history of individual rewards for a whistleblower
operationId: getWhistleblowerEarnings
tags:
- Whistleblower
security: []
parameters:
- name: id
in: path
required: true
description: The unique identifier of the whistleblower
schema:
type: string
minLength: 1
example: "wb-123e4567-e89b-12d3-a456-426614174000"
responses:
"200":
description: Earnings data retrieved successfully
content:
application/json:
schema:
$ref: "#/components/schemas/EarningsResponse"
examples:
mixedStatus:
summary: Whistleblower with mixed payout statuses
value:
totals:
totalNgn: 750000
pendingNgn: 450000
paidNgn: 300000
totalUsdc: 500
pendingUsdc: 300
paidUsdc: 200
history:
- rewardId: "rw-001"
listingId: "lst-456"
dealId: "deal-789"
amountNgn: 300000
amountUsdc: 200
status: "paid"
createdAt: "2024-01-15T10:30:00Z"
paidAt: "2024-01-20T14:45:00Z"
- rewardId: "rw-002"
listingId: "lst-457"
dealId: "deal-790"
amountNgn: 225000
amountUsdc: 150
status: "pending"
createdAt: "2024-01-10T08:15:00Z"
- rewardId: "rw-003"
listingId: "lst-458"
dealId: "deal-791"
amountNgn: 225000
amountUsdc: 150
status: "payable"
createdAt: "2024-01-05T16:20:00Z"
allPending:
summary: Whistleblower with all pending rewards
value:
totals:
totalNgn: 600000
pendingNgn: 600000
paidNgn: 0
totalUsdc: 400
pendingUsdc: 400
paidUsdc: 0
history:
- rewardId: "rw-004"
listingId: "lst-459"
dealId: "deal-792"
amountNgn: 300000
amountUsdc: 200
status: "pending"
createdAt: "2024-02-01T12:00:00Z"
- rewardId: "rw-005"
listingId: "lst-460"
dealId: "deal-793"
amountNgn: 300000
amountUsdc: 200
status: "pending"
createdAt: "2024-01-28T09:30:00Z"
"400":
description: Invalid request - whistleblower ID format is invalid
content: