/
openapi.yml
965 lines (964 loc) · 27.7 KB
/
openapi.yml
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
tags:
-
name: Admin
-
name: Common
-
name: Member
-
name: Authenticate
components:
schemas:
AddRentalItemEventDto:
required:
- serialNo
properties:
itemName:
type: string
serialNo:
type: string
description: レンタル品登録用DTO
type: object
AddReservationEventDto:
required:
- endDateTime
- rentalItemId
- startDateTime
- userAccountId
properties:
endDateTime:
$ref: '#/components/schemas/LocalDateTime'
note:
type: string
rentalItemId:
format: int32
type: integer
startDateTime:
$ref: '#/components/schemas/LocalDateTime'
userAccountId:
format: int32
type: integer
description: 予約登録用DTO
type: object
AddUserAccountEventDto:
required:
- loginId
- password
- userName
- userType
properties:
contact:
type: string
loginId:
type: string
password:
type: string
phoneNumber:
type: string
userName:
type: string
userType:
$ref: '#/components/schemas/UserType'
description: ユーザ登録用DTO
type: object
GenericErrorInfo:
properties:
errorMessage:
description: 発生した例外に設定されていたメッセージ
example: 例外のエラーメッセージ
type: string
errorReason:
description: エラー理由としてBussinessFlowExceptionExceptionの場合はCuaseTypeをそれ以外は発生した例外のクラス名を設定
example: 例外クラス名
type: string
description: エラー情報
type: object
LocalDateTime:
description: 日時型フォーマット
example: 20220904 09:00
format: yyyyMMdd HH:ss
type: string
LoginEventDto:
required:
- loginId
- password
properties:
loginId:
maxLength: 10
minLength: 5
type: string
password:
maxLength: 10
minLength: 5
type: string
description: ログインDTO
type: object
RentalItemResourceDto:
required:
- id
- serialNo
properties:
id:
format: int32
type: integer
itemName:
type: string
serialNo:
type: string
description: レンタル品DTO
type: object
ReservationResourceDto:
required:
- endDateTime
- id
- rentalItemId
- startDateTime
- userAccountId
properties:
endDateTime:
$ref: '#/components/schemas/LocalDateTime'
id:
format: int32
type: integer
note:
type: string
rentalItemDto:
$ref: '#/components/schemas/RentalItemResourceDto'
rentalItemId:
format: int32
type: integer
startDateTime:
$ref: '#/components/schemas/LocalDateTime'
userAccountDto:
$ref: '#/components/schemas/UserAccountResourceDto'
userAccountId:
format: int32
type: integer
description: 予約DTO
type: object
UserAccountResourceDto:
required:
- id
- loginId
- password
- userType
properties:
contact:
type: string
id:
format: int32
type: integer
loginId:
type: string
password:
type: string
phoneNumber:
type: string
userName:
type: string
userType:
$ref: '#/components/schemas/UserType'
groups:
items:
type: string
type: array
uniqueItems: true
userId:
type: string
userPrincipalName:
type: string
description: ユーザDTO
type: object
UserType:
enum:
- ADMIN
- MEMBER
type: string
ValidationErrorInfoImpl:
properties:
errorMessage:
type: string
errorReason:
type: string
errorItems:
items:
$ref: '#/components/schemas/ValidationErrorItemImpl'
type: array
description: パラメータチェックエラー情報
type: object
ValidationErrorItemImpl:
properties:
fieldName:
description: エラーとなった項目
type: string
message:
description: エラーメッセージ
type: string
description: 1件ごとのチェックエラー情報
type: object
responses:
NoContent:
description: 該当データなしの場合。1件取得で戻り値にnullを返すことが妥当な場合は正常のため404ではなくボディなしの204を返す
NotFound:
headers:
Rms-Exception:
description: 発生例外のBusinessFlowExceptionが設定される
required: true
schema:
type: string
style: simple
content:
application/json:
schema:
$ref: '#/components/schemas/GenericErrorInfo'
description: 該当データがない場合
ServerError:
headers:
Rms-Exception:
description: 発生例外のRmsSystemExceptionが設定される
required: true
schema:
type: string
style: simple
content:
application/json:
schema:
$ref: '#/components/schemas/GenericErrorInfo'
description: アプリケーション内部でエラーが発生した場合
Forbidden:
headers:
Rms-Exception:
description: 発生例外のBusinessFlowExceptionが設定される
required: true
schema:
type: string
style: simple
content:
application/json:
schema:
$ref: '#/components/schemas/GenericErrorInfo'
description: 対象データに対する操作権限がない場合
UnknownData:
headers:
Rms-Exception:
description: 発生例外のBusinessFlowExceptionが設定される
required: true
schema:
type: string
style: simple
content:
application/json:
schema:
$ref: '#/components/schemas/GenericErrorInfo'
description: 処理対象データが存在しない場合
DataDupricate:
headers:
Rms-Exception:
description: 発生例外のBusinessFlowExceptionが設定される
required: true
schema:
type: string
style: simple
content:
application/json:
schema:
$ref: '#/components/schemas/GenericErrorInfo'
description: 登録データが既に登録されている
DataRefered:
headers:
Rms-Exception:
description: 発生例外のBusinessFlowExceptionが設定される
required: true
schema:
type: string
style: simple
content:
application/json:
schema:
$ref: '#/components/schemas/GenericErrorInfo'
description: 操作対象を参照するデータが存在する
ParameterError:
headers:
Rms-Exception:
description: 発生例外のConstraintViolationExceptionが設定される
required: true
schema:
type: string
style: simple
content:
application/json:
schema:
$ref: '#/components/schemas/ValidationErrorInfoImpl'
description: パラメータエラーの場合
securitySchemes:
RmsJwtAuth:
bearerFormat: JWT
description: 認証と認可はMicroProfile JWT RBAC Securityの仕様をもとに行い認証エラーの場合は401を認可エラーの場合は403を返す
in: header
scheme: bearer
type: http
info:
contact:
name: 課外活動
url: https://extact-io.github.io/rms-website/
title: レンタル予約システム公開API
version: '-'
openapi: 3.0.3
paths:
/api/rms/items:
post:
tags:
- Admin
security:
- RmsJwtAuth: []
description: シリアル番号が既に使われている場合は409を返す
operationId: addRentalItem
requestBody:
content:
application/json:
schema:
$ref: '#/components/schemas/AddRentalItemEventDto'
responses:
'200':
content:
application/json:
schema:
$ref: '#/components/schemas/RentalItemResourceDto'
description: 登録成功
'400':
$ref: '#/components/responses/ParameterError'
'409':
$ref: '#/components/responses/DataDupricate'
'500':
$ref: '#/components/responses/ServerError'
summary: レンタル品を登録する
get:
tags:
- Member
- Admin
security:
- RmsJwtAuth: []
description: 登録されているすべてのレンタル品を取得する
operationId: getAllRentalItems
responses:
'200':
content:
application/json:
schema:
items:
$ref: '#/components/schemas/RentalItemResourceDto'
type: array
description: 検索結果
summary: レンタル品の全件を取得する
put:
tags:
- Admin
security:
- RmsJwtAuth: []
description: 依頼されたレンタル品を更新する
operationId: updateRentalItem
requestBody:
content:
application/json:
schema:
$ref: '#/components/schemas/RentalItemResourceDto'
responses:
'200':
content:
application/json:
schema:
$ref: '#/components/schemas/RentalItemResourceDto'
description: 登録成功
'400':
$ref: '#/components/responses/ParameterError'
'404':
$ref: '#/components/responses/UnknownData'
'500':
$ref: '#/components/responses/ServerError'
summary: レンタル品を更新する
/api/rms/items/rentable:
get:
tags:
- Member
parameters:
-
description: 利用開始日時
in: query
name: from
required: true
schema:
allOf:
-
$ref: '#/components/schemas/LocalDateTime'
-
nullable: false
-
description: 利用開始日時
in: query
name: to
required: true
schema:
allOf:
-
$ref: '#/components/schemas/LocalDateTime'
-
nullable: false
security:
- RmsJwtAuth: []
description: 該当期間に予約可能なレンタル品を検索する
operationId: findCanRentedItemAtTerm
responses:
'200':
content:
application/json:
schema:
items:
$ref: '#/components/schemas/RentalItemResourceDto'
type: array
description: 検索結果
'400':
$ref: '#/components/responses/ParameterError'
'500':
$ref: '#/components/responses/ServerError'
summary: 該当期間に予約可能なレンタル品を検索する
/api/rms/items/{itemId}:
delete:
tags:
- Admin
parameters:
-
description: レンタル品ID
in: path
name: itemId
required: true
schema:
format: int32
type: integer
security:
- RmsJwtAuth: []
description: 削除対象のレンタル品を参照する予約が存在する場合は削除は行わずエラーにする
operationId: deleteRentalItem
responses:
'200':
description: 登録成功
'400':
$ref: '#/components/responses/ParameterError'
'404':
$ref: '#/components/responses/UnknownData'
'409':
$ref: '#/components/responses/DataRefered'
'500':
$ref: '#/components/responses/ServerError'
summary: レンタル品を削除する
/api/rms/items/{itemId}/rentable:
get:
tags:
- Member
parameters:
-
description: レンタル品ID
in: path
name: itemId
required: true
schema:
format: int32
type: integer
-
description: 利用開始日時
in: query
name: from
required: true
schema:
allOf:
-
$ref: '#/components/schemas/LocalDateTime'
-
nullable: false
-
description: 利用開始日時
in: query
name: to
required: true
schema:
allOf:
-
$ref: '#/components/schemas/LocalDateTime'
-
nullable: false
security:
- RmsJwtAuth: []
description: レンタル品が該当期間に予約可能かを返す
operationId: canRentedItemAtTerm
responses:
'200':
content:
application/json:
schema:
type: boolean
description: trueならレンタル可
'400':
$ref: '#/components/responses/ParameterError'
'500':
$ref: '#/components/responses/ServerError'
summary: レンタル品が該当期間に予約可能かを返す
/api/rms/reservations:
post:
tags:
- Member
security:
- RmsJwtAuth: []
description: 予約対象のレンタル品が存在しない場合は404を予定期間に別の予約が既に入っている場合は409を返す
operationId: addReservation
requestBody:
content:
application/json:
schema:
$ref: '#/components/schemas/AddReservationEventDto'
responses:
'200':
content:
application/json:
schema:
$ref: '#/components/schemas/ReservationResourceDto'
description: 登録成功
'400':
$ref: '#/components/responses/ParameterError'
'404':
$ref: '#/components/responses/UnknownData'
'409':
$ref: '#/components/responses/DataDupricate'
'500':
$ref: '#/components/responses/ServerError'
summary: レンタル品を予約する
get:
tags:
- Admin
security:
- RmsJwtAuth: []
description: 登録されているすべての予約を取得する
operationId: getAllReservations
responses:
'200':
content:
application/json:
schema:
items:
$ref: '#/components/schemas/ReservationResourceDto'
type: array
description: 検索結果
summary: 予約の全件を取得する
put:
tags:
- Admin
security:
- RmsJwtAuth: []
description: 依頼された予約を更新する。ユーザアカウントとレンタル品のエンティティは更新時に使用していないためIDのみ設定すればよい
operationId: updateReservation
requestBody:
content:
application/json:
schema:
$ref: '#/components/schemas/ReservationResourceDto'
responses:
'200':
content:
application/json:
schema:
$ref: '#/components/schemas/ReservationResourceDto'
description: 登録成功。IDに対するユーザアカウントとレンタル品のエンティティは設定されて返される
'400':
$ref: '#/components/responses/ParameterError'
'404':
$ref: '#/components/responses/UnknownData'
'500':
$ref: '#/components/responses/ServerError'
summary: 予約を更新する
/api/rms/reservations/item/{itemId}:
get:
tags:
- Member
parameters:
-
description: レンタル品ID
in: path
name: itemId
required: true
schema:
format: int32
type: integer
security:
- RmsJwtAuth: []
description: 指定されたレンタル品に対する予約を検索する
operationId: findReservationByRentalItemId
responses:
'200':
content:
application/json:
schema:
items:
$ref: '#/components/schemas/ReservationResourceDto'
type: array
description: 検索結果
'400':
$ref: '#/components/responses/ParameterError'
'500':
$ref: '#/components/responses/ServerError'
summary: 指定されたレンタル品に対する予約を検索する
/api/rms/reservations/item/{itemId}/startdate/{startDate}:
get:
tags:
- Member
parameters:
-
description: レンタル品ID
in: path
name: itemId
required: true
schema:
format: int32
type: integer
-
description: 利用開始日
in: path
name: startDate
required: true
schema:
example: 20201230
format: yyyyMMdd
nullable: false
type: string
security:
- RmsJwtAuth: []
description: 指定されたレンタル品と利用開始日に一致する予約を検索する
operationId: findReservationByRentalItemAndStartDate
responses:
'200':
content:
application/json:
schema:
items:
$ref: '#/components/schemas/ReservationResourceDto'
type: array
description: 検索結果
'400':
$ref: '#/components/responses/ParameterError'
'500':
$ref: '#/components/responses/ServerError'
summary: 指定されたレンタル品と利用開始日で予約を検索する
/api/rms/reservations/own:
get:
tags:
- Member
security:
- RmsJwtAuth: []
description: ログインユーザが予約者となっている予約の一覧を取得する。このAPIは/reservations/reserver/{reserverId}のエイリアスとなっている
operationId: getOwnReservations
responses:
'200':
content:
application/json:
schema:
items:
$ref: '#/components/schemas/ReservationResourceDto'
type: array
description: 検索結果
'400':
$ref: '#/components/responses/ParameterError'
summary: 自分の予約一覧を取得する
/api/rms/reservations/own/{reservationId}:
delete:
tags:
- Member
parameters:
-
description: 予約ID
in: path
name: reservationId
required: true
schema:
format: int32
type: integer
security:
- RmsJwtAuth: []
description: 依頼された予約IDに対する予約をキャンセルする。予約のキャンセルは予約した人しか行えない。他の人が予約キャンセルを行った場合は禁止操作としてエラーにする
operationId: cancelReservation
responses:
'200':
description: 登録成功
'400':
$ref: '#/components/responses/ParameterError'
'403':
$ref: '#/components/responses/Forbidden'
'404':
$ref: '#/components/responses/UnknownData'
'500':
$ref: '#/components/responses/ServerError'
summary: 予約をキャンセルする
/api/rms/reservations/reserver/{reserverId}:
get:
tags:
- Member
parameters:
-
description: ユーザID
in: path
name: reserverId
required: true
schema:
format: int32
type: integer
security:
- RmsJwtAuth: []
description: 指定されたユーザが予約者の予約を検索する
operationId: findReservationByReserverId
responses:
'200':
content:
application/json:
schema:
items:
$ref: '#/components/schemas/ReservationResourceDto'
type: array
description: 検索結果
'400':
$ref: '#/components/responses/ParameterError'
'500':
$ref: '#/components/responses/ServerError'
summary: 指定されたユーザが予約者の予約を検索する
/api/rms/reservations/{reservationId}:
delete:
tags:
- Admin
parameters:
-
description: 予約ID
in: path
name: reservationId
required: true
schema:
format: int32
type: integer
security:
- RmsJwtAuth: []
description: 予約を削除する
operationId: deleteReservation
responses:
'200':
description: 登録成功
'400':
$ref: '#/components/responses/ParameterError'
'404':
$ref: '#/components/responses/UnknownData'
'500':
$ref: '#/components/responses/ServerError'
summary: 予約を削除する
/api/rms/users:
post:
tags:
- Admin
security:
- RmsJwtAuth: []
description: ログインIDが既に使われている場合は409を返す
operationId: addUserAccount
requestBody:
content:
application/json:
schema:
$ref: '#/components/schemas/AddUserAccountEventDto'
responses:
'200':
content:
application/json:
schema:
$ref: '#/components/schemas/UserAccountResourceDto'
description: 登録成功
'400':
$ref: '#/components/responses/ParameterError'
'409':
$ref: '#/components/responses/DataDupricate'
'500':
$ref: '#/components/responses/ServerError'
summary: ユーザを登録する
get:
tags:
- Admin
security:
- RmsJwtAuth: []
description: 登録されているすべてのユーザを取得する
operationId: getAllUserAccounts
responses:
'200':
content:
application/json:
schema:
items:
$ref: '#/components/schemas/UserAccountResourceDto'
type: array
description: 検索結果
summary: ユーザの全件を取得する
put:
tags:
- Admin
security:
- RmsJwtAuth: []
description: 依頼されたユーザを更新する
operationId: updateUserAccount
requestBody:
content:
application/json:
schema:
$ref: '#/components/schemas/UserAccountResourceDto'
responses:
'200':
content:
application/json:
schema:
$ref: '#/components/schemas/UserAccountResourceDto'
description: 登録成功
'400':
$ref: '#/components/responses/ParameterError'
'404':
$ref: '#/components/responses/UnknownData'
'500':
$ref: '#/components/responses/ServerError'
summary: ユーザを更新する
/api/rms/users/own:
get:
tags:
- Common
security:
- RmsJwtAuth: []
description: ログインしているユーザ自身のプロファイル情報を返す
operationId: getOwnUserProfile
responses:
'200':
content:
application/json:
schema:
$ref: '#/components/schemas/UserAccountResourceDto'
description: プロファイル情報
'404':
$ref: '#/components/responses/NotFound'
'500':
$ref: '#/components/responses/ServerError'
summary: 自分のプロファイル情報を取得する
put:
tags:
- Common
security:
- RmsJwtAuth: []
description: 自分以外の情報を更新しようとした場合は禁止操作として403を返す
operationId: updateUserProfile
requestBody:
content:
application/json:
schema:
$ref: '#/components/schemas/UserAccountResourceDto'
responses:
'200':
content:
application/json:
schema:
$ref: '#/components/schemas/UserAccountResourceDto'
description: 登録成功
'400':
$ref: '#/components/responses/ParameterError'
'403':
$ref: '#/components/responses/Forbidden'
'404':
$ref: '#/components/responses/UnknownData'
'500':
$ref: '#/components/responses/ServerError'
summary: 自分のプロファイル情報を更新する
/api/rms/users/{userAccountId}:
delete:
tags:
- Admin
parameters:
-
description: ユーザID
in: path
name: userAccountId
required: true
schema:
format: int32
type: integer
security:
- RmsJwtAuth: []
description: 削除対象のユーザを参照する予約が存在する場合は削除は行わずエラーにする
operationId: deleteUserAccount
responses:
'200':
description: 登録成功
'400':
$ref: '#/components/responses/ParameterError'
'404':
$ref: '#/components/responses/UnknownData'
'409':
$ref: '#/components/responses/DataRefered'
'500':
$ref: '#/components/responses/ServerError'
summary: ユーザを削除する
/auth/login:
post:
tags:
- Authenticate
description: ログイン名とパスワードに一致するユーザを取得する
operationId: authenticate
requestBody:
content:
application/json:
schema:
$ref: '#/components/schemas/LoginEventDto'
responses:
'200':
content:
application/json:
schema:
$ref: '#/components/schemas/UserAccountResourceDto'
description: 認証成功
'400':
$ref: '#/components/responses/ParameterError'
'404':
$ref: '#/components/responses/NotFound'
'500':
$ref: '#/components/responses/ServerError'
summary: ユーザ認証を行う
get:
tags:
- Authenticate
parameters:
-
description: ログインId
in: query
name: loginId
required: true
schema:
maxLength: 10
minLength: 5
type: string
-
description: パスワード
in: query
name: password
required: true
schema:
maxLength: 10
minLength: 5
type: string
description: ログイン名とパスワードに一致するユーザを取得する
operationId: authenticateForTest
responses:
'200':
content:
application/json:
schema:
$ref: '#/components/schemas/UserAccountResourceDto'
description: 認証成功
'400':
$ref: '#/components/responses/ParameterError'
'404':
$ref: '#/components/responses/NotFound'
'500':
$ref: '#/components/responses/ServerError'
summary: ユーザ認証を行う(curlのテスト用)