Skip to content

Commit f487c4e

Browse files
committed
doc update
1 parent e748e5a commit f487c4e

1 file changed

Lines changed: 102 additions & 7 deletions

File tree

API_DOCS.md

Lines changed: 102 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -80,10 +80,12 @@ Success (200 OK):
8080
"text": "Detailed description of the camera...",
8181
"payPalMail": "seller@example.com",
8282
"images": [
83-
"base64_encoded_image_1",
84-
"base64_encoded_image_2"
83+
"base64_encoded_image_1"
8584
],
8685
"comments": [],
86+
"isTerminated": false,
87+
"acceptanceList": [],
88+
"acceptedUser": {},
8789
"created_at": "2024-01-15T10:30:00Z"
8890
}
8991
]
@@ -132,6 +134,9 @@ Success (200 OK):
132134
"base64_encoded_image_2"
133135
],
134136
"comments": [],
137+
"isTerminated": false,
138+
"acceptanceList": [],
139+
"acceptedUser": {},
135140
"created_at": "2024-01-15T10:30:00Z"
136141
}
137142
```
@@ -363,6 +368,9 @@ Success (200 OK):
363368
"base64_encoded_image_1"
364369
],
365370
"comments": [],
371+
"isTerminated": false,
372+
"acceptanceList": [],
373+
"acceptedUser": {},
366374
"created_at": "2024-01-15T10:30:00Z"
367375
}
368376
]
@@ -388,7 +396,7 @@ Error (500 Internal Server Error):
388396

389397
**Endpoint:** `PATCH /api/v1/users/{creatorId}/{postId}`
390398

391-
**Description:** Updates an existing post. Only the creator can update their own post.
399+
**Description:** Updates an existing post. Only the creator can update their own post. This endpoint now uses the full Post model including acceptance functionality.
392400

393401
**Authentication:** Not required
394402

@@ -414,7 +422,26 @@ Content-Type: application/json
414422
"images": [
415423
"base64 image1",
416424
"base64 image2"
417-
]
425+
],
426+
"comments": [],
427+
"isTerminated": false,
428+
"acceptanceList": [
429+
{
430+
"userId": "buyer-firebase-uuid-1",
431+
"userName": "John Buyer",
432+
"requestedAt": "2025-10-19T08:30:00Z"
433+
},
434+
{
435+
"userId": "buyer-firebase-uuid-2",
436+
"userName": "Jane Smith",
437+
"requestedAt": "2025-10-19T09:15:00Z"
438+
}
439+
],
440+
"acceptedUser": {
441+
"userId": "buyer-firebase-uuid-1",
442+
"userName": "John Buyer",
443+
"acceptedAt": "2025-10-19T10:00:00Z"
444+
}
418445
}
419446
```
420447

@@ -425,8 +452,12 @@ Content-Type: application/json
425452
- `description` (string, required): Short description of the item
426453
- `tags` (array of strings, required): Non-empty array of tags/categories
427454
- `text` (string, required): Detailed description/content
428-
- `payPalMail` (string, required): Valid email address for PayPal payments
455+
- `payPalMail` (string, optional): Valid email address for PayPal payments
429456
- `images` (array of strings, required): Non-empty array of Base64 encoded images
457+
- `comments` (array of Comment objects, required): Array of comments on the post
458+
- `isTerminated` (boolean, required): Indicates whether the post/listing is terminated/closed. Must be explicitly set to `true` or `false`
459+
- `acceptanceList` (array of AcceptanceRequest objects, required): List of users who have requested to accept/purchase the item
460+
- `acceptedUser` (AcceptedUser object, required): The user who has been accepted for the item. Use empty object `{}` if no user accepted yet
430461

431462
**Response:**
432463

@@ -652,10 +683,32 @@ Internal Server Error
652683
"payPalMail": "string (email format)",
653684
"images": ["string (Base64)"],
654685
"comments": [Comment],
686+
"isTerminated": boolean,
687+
"acceptanceList": [AcceptanceRequest],
688+
"acceptedUser": AcceptedUser,
655689
"created_at": "timestamp (ISO 8601)"
656690
}
657691
```
658692

693+
### Post Object (Update/PATCH Request)
694+
**Note:** When updating a post via PATCH endpoint, you must provide the full Post object with all required fields.
695+
```json
696+
{
697+
"creatorId": "string (required, Firebase UUID)",
698+
"creatorMail": "string (required, email format)",
699+
"title": "string (required)",
700+
"description": "string (required)",
701+
"tags": ["string"] (required, non-empty array),
702+
"text": "string (required)",
703+
"payPalMail": "string (optional, email format)",
704+
"images": ["string"] (required, non-empty array of Base64 encoded images),
705+
"comments": [Comment] (required, array of comment objects),
706+
"isTerminated": boolean (required, must be explicitly true or false),
707+
"acceptanceList": [AcceptanceRequest] (required, array of acceptance requests),
708+
"acceptedUser": AcceptedUser (required, object with user details or empty object {})
709+
}
710+
```
711+
659712
### InsertPost Object (Create/Update Request)
660713
```json
661714
{
@@ -682,6 +735,25 @@ Internal Server Error
682735
}
683736
```
684737

738+
### AcceptanceRequest Object
739+
```json
740+
{
741+
"userId": "string (required, Firebase UUID)",
742+
"userName": "string (required)",
743+
"requestedAt": "string (ISO 8601 timestamp)"
744+
}
745+
```
746+
747+
### AcceptedUser Object
748+
```json
749+
{
750+
"userId": "string (Firebase UUID)",
751+
"userName": "string",
752+
"acceptedAt": "string (ISO 8601 timestamp)"
753+
}
754+
```
755+
**Note:** When no user has been accepted yet, use an empty object `{}`.
756+
685757
### Meme Object
686758
```json
687759
{
@@ -723,16 +795,39 @@ Internal Server Error
723795
- `tags` must be a non-empty array
724796
- `images` must be a non-empty array
725797

726-
### Required Fields for InsertPost
798+
### Boolean Validation
799+
- `isTerminated` must be explicitly set to `true` or `false` (cannot be omitted in PATCH requests)
800+
801+
### Required Fields for InsertPost (Create)
727802
All fields in InsertPost object are required:
728803
- creatorId
729804
- creatorMail
730805
- title
731806
- description
732807
- tags
733808
- text
734-
- payPalMail
809+
- payPalMail (optional)
810+
- images
811+
812+
### Required Fields for Post (Update/PATCH)
813+
All fields in Post object are required:
814+
- creatorId
815+
- creatorMail
816+
- title
817+
- description
818+
- tags
819+
- text
820+
- payPalMail (optional)
735821
- images
822+
- comments
823+
- isTerminated (must be boolean: true or false)
824+
- acceptanceList
825+
- acceptedUser
826+
827+
### Required Fields for AcceptanceRequest
828+
- userId
829+
- userName
830+
- requestedAt (optional, can be set by client or server)
736831

737832
### Required Fields for Comment
738833
All fields in Comment object are required:

0 commit comments

Comments
 (0)