ABAO77 commited on
Commit
79fdcaa
·
verified ·
1 Parent(s): 5d05c00

Upload 157 files

Browse files
src/apis/controllers/post_controller.py CHANGED
@@ -136,7 +136,8 @@ async def list_posts_by_destination_controller(destination_id: str, user_id: str
136
  "name": info.get("name"),
137
  "picture": info.get("picture"),
138
  }
139
- for info in user_infos if info
 
140
  }
141
 
142
  # Get destination name
@@ -190,10 +191,7 @@ async def list_posts_by_destination_controller(destination_id: str, user_id: str
190
  return {"status": "error", "message": str(e)}
191
 
192
 
193
-
194
- async def update_a_post_controller(
195
- user_id: str, post_id: str, content: str, destination_id: str
196
- ) -> Dict:
197
  try:
198
  exist_data = await PostCRUD.find_by_id(post_id)
199
  if exist_data["user_id"] != user_id:
@@ -207,7 +205,6 @@ async def update_a_post_controller(
207
  {"_id": ObjectId(post_id)},
208
  {
209
  "content": content,
210
- "destination_id": destination_id,
211
  },
212
  )
213
  return {"status": "success", "message": "Post updated successfully"}
 
136
  "name": info.get("name"),
137
  "picture": info.get("picture"),
138
  }
139
+ for info in user_infos
140
+ if info
141
  }
142
 
143
  # Get destination name
 
191
  return {"status": "error", "message": str(e)}
192
 
193
 
194
+ async def update_a_post_controller(user_id: str, post_id: str, content: str) -> Dict:
 
 
 
195
  try:
196
  exist_data = await PostCRUD.find_by_id(post_id)
197
  if exist_data["user_id"] != user_id:
 
205
  {"_id": ObjectId(post_id)},
206
  {
207
  "content": content,
 
208
  },
209
  )
210
  return {"status": "success", "message": "Post updated successfully"}
src/apis/routes/post_router.py CHANGED
@@ -99,13 +99,12 @@ async def list_all_posts_destination(
99
  class BodyUpdatePost(BaseDocument):
100
  content: str = Field(..., description="Post's content", min_length=1)
101
  post_id: str = Field(..., description="Post's id", min_length=1)
102
- destination_id: str = Field(..., description="Destination's id", min_length=1)
103
 
104
  class Config:
105
  json_schema_extra = {
106
  "example": {
107
  "content": "John Doe",
108
- "destination_id": "1234567890",
109
  }
110
  }
111
 
@@ -118,7 +117,6 @@ async def update_post(body: BodyUpdatePost, user: user_dependency):
118
  user["id"],
119
  body.post_id,
120
  body.content,
121
- body.destination_id,
122
  )
123
  logger.info(f"RESULT: {result}")
124
  if result["status"] == "error":
 
99
  class BodyUpdatePost(BaseDocument):
100
  content: str = Field(..., description="Post's content", min_length=1)
101
  post_id: str = Field(..., description="Post's id", min_length=1)
 
102
 
103
  class Config:
104
  json_schema_extra = {
105
  "example": {
106
  "content": "John Doe",
107
+ "post_id": "1234567890",
108
  }
109
  }
110
 
 
117
  user["id"],
118
  body.post_id,
119
  body.content,
 
120
  )
121
  logger.info(f"RESULT: {result}")
122
  if result["status"] == "error":