|
870 | 870 | "schema": {
|
871 | 871 | "type": "object",
|
872 | 872 | "properties": {
|
873 |
| - "posts": { |
| 873 | + "likes": { |
874 | 874 | "type": "array",
|
875 | 875 | "items": {
|
876 | 876 | "$ref": "#/components/schemas/Like"
|
|
922 | 922 | }
|
923 | 923 | }
|
924 | 924 | },
|
| 925 | + "/posts/{postId}/comments": { |
| 926 | + "get": { |
| 927 | + "description": "Index the post comments", |
| 928 | + "tags": [ |
| 929 | + "Comments" |
| 930 | + ], |
| 931 | + "parameters": [ |
| 932 | + { |
| 933 | + "name": "count", |
| 934 | + "in": "query", |
| 935 | + "description": "Number of comments to retrieve", |
| 936 | + "required": false, |
| 937 | + "schema": { |
| 938 | + "type": "integer", |
| 939 | + "example": 5, |
| 940 | + "default": 10 |
| 941 | + } |
| 942 | + }, |
| 943 | + { |
| 944 | + "name": "lastId", |
| 945 | + "in": "query", |
| 946 | + "description": "ID of the last comment retrieved", |
| 947 | + "required": false, |
| 948 | + "schema": { |
| 949 | + "type": "integer", |
| 950 | + "example": 13 |
| 951 | + } |
| 952 | + } |
| 953 | + ], |
| 954 | + "responses": { |
| 955 | + "200": { |
| 956 | + "description": "list of the comments of a post", |
| 957 | + "content": { |
| 958 | + "application/json": { |
| 959 | + "schema": { |
| 960 | + "type": "object", |
| 961 | + "properties": { |
| 962 | + "comments": { |
| 963 | + "type": "array", |
| 964 | + "items": { |
| 965 | + "$ref": "#/components/schemas/Comment" |
| 966 | + } |
| 967 | + } |
| 968 | + } |
| 969 | + } |
| 970 | + } |
| 971 | + } |
| 972 | + } |
| 973 | + } |
| 974 | + } |
| 975 | + }, |
| 976 | + "/comments": { |
| 977 | + "get": { |
| 978 | + "description": "Index the user comments", |
| 979 | + "tags": [ |
| 980 | + "Comments" |
| 981 | + ], |
| 982 | + "parameters": [ |
| 983 | + { |
| 984 | + "name": "count", |
| 985 | + "in": "query", |
| 986 | + "description": "Number of comments to retrieve", |
| 987 | + "required": false, |
| 988 | + "schema": { |
| 989 | + "type": "integer", |
| 990 | + "example": 5, |
| 991 | + "default": 10 |
| 992 | + } |
| 993 | + }, |
| 994 | + { |
| 995 | + "name": "lastId", |
| 996 | + "in": "query", |
| 997 | + "description": "ID of the last comment retrieved", |
| 998 | + "required": false, |
| 999 | + "schema": { |
| 1000 | + "type": "integer", |
| 1001 | + "example": 13 |
| 1002 | + } |
| 1003 | + } |
| 1004 | + ], |
| 1005 | + "responses": { |
| 1006 | + "200": { |
| 1007 | + "description": "list of the comments of a post", |
| 1008 | + "content": { |
| 1009 | + "application/json": { |
| 1010 | + "schema": { |
| 1011 | + "type": "object", |
| 1012 | + "properties": { |
| 1013 | + "comments": { |
| 1014 | + "type": "array", |
| 1015 | + "items": { |
| 1016 | + "$ref": "#/components/schemas/Comment" |
| 1017 | + } |
| 1018 | + } |
| 1019 | + } |
| 1020 | + } |
| 1021 | + } |
| 1022 | + } |
| 1023 | + } |
| 1024 | + } |
| 1025 | + }, |
| 1026 | + "post": { |
| 1027 | + "operationId": "comments-store", |
| 1028 | + "description": "Store a new comment", |
| 1029 | + "tags": [ |
| 1030 | + "Comments" |
| 1031 | + ], |
| 1032 | + "requestBody": { |
| 1033 | + "required": true, |
| 1034 | + "content": { |
| 1035 | + "application/json": { |
| 1036 | + "schema": { |
| 1037 | + "$ref": "#/components/schemas/NewComment" |
| 1038 | + } |
| 1039 | + } |
| 1040 | + } |
| 1041 | + }, |
| 1042 | + "responses": { |
| 1043 | + "201": { |
| 1044 | + "description": "The new comment created." |
| 1045 | + } |
| 1046 | + } |
| 1047 | + } |
| 1048 | + }, |
| 1049 | + "/comments/{commentId}": { |
| 1050 | + "delete": { |
| 1051 | + "description": "Delete the comment", |
| 1052 | + "tags": [ |
| 1053 | + "Comments" |
| 1054 | + ], |
| 1055 | + "responses": { |
| 1056 | + "204": { |
| 1057 | + "description": "The comment deleted." |
| 1058 | + }, |
| 1059 | + "404": { |
| 1060 | + "description": "The comment not found." |
| 1061 | + } |
| 1062 | + } |
| 1063 | + } |
| 1064 | + }, |
925 | 1065 | "/search/posts": {
|
926 | 1066 | "get": {
|
927 | 1067 | "description": "Search posts",
|
|
1213 | 1353 | "id": {
|
1214 | 1354 | "type": "integer",
|
1215 | 1355 | "example": 13,
|
1216 |
| - "description": "Unique id of post (uint64)" |
| 1356 | + "description": "Unique id (uint64)" |
1217 | 1357 | },
|
1218 | 1358 | "user_id": {
|
1219 | 1359 | "type": "integer",
|
|
1230 | 1370 | }
|
1231 | 1371 | }
|
1232 | 1372 | },
|
| 1373 | + "Comment": { |
| 1374 | + "allOf": [ |
| 1375 | + { |
| 1376 | + "$ref": "#/components/schemas/NewPost" |
| 1377 | + }, |
| 1378 | + { |
| 1379 | + "type": "object", |
| 1380 | + "properties": { |
| 1381 | + "id": { |
| 1382 | + "type": "integer", |
| 1383 | + "example": 13, |
| 1384 | + "description": "Unique id (uint64)" |
| 1385 | + }, |
| 1386 | + "user": { |
| 1387 | + "$ref": "#/components/schemas/User" |
| 1388 | + }, |
| 1389 | + "post": { |
| 1390 | + "$ref": "#/components/schemas/Post" |
| 1391 | + }, |
| 1392 | + "created_at": { |
| 1393 | + "type": "string", |
| 1394 | + "example": "2023-11-28T13:36:30.956Z", |
| 1395 | + "description": "Registration time" |
| 1396 | + } |
| 1397 | + } |
| 1398 | + } |
| 1399 | + ] |
| 1400 | + }, |
1233 | 1401 | "Post": {
|
1234 | 1402 | "allOf": [
|
1235 | 1403 | {
|
|
1329 | 1497 | }
|
1330 | 1498 | }
|
1331 | 1499 | },
|
| 1500 | + "NewComment": { |
| 1501 | + "type": "object", |
| 1502 | + "properties": { |
| 1503 | + "user_id": { |
| 1504 | + "type": "integer", |
| 1505 | + "example": 13, |
| 1506 | + "description": "Unique id of user (uint64)" |
| 1507 | + }, |
| 1508 | + "post_id": { |
| 1509 | + "type": "integer", |
| 1510 | + "example": 13, |
| 1511 | + "description": "Unique id of post (uint64)" |
| 1512 | + }, |
| 1513 | + "text": { |
| 1514 | + "type": "string", |
| 1515 | + "example": "Wow! Nice...", |
| 1516 | + "description": "The comment text" |
| 1517 | + } |
| 1518 | + } |
| 1519 | + }, |
1332 | 1520 | "Error": {
|
1333 | 1521 | "type": "object",
|
1334 | 1522 | "properties": {
|
|
0 commit comments