Spaces:
Running
Running
Commit
·
7887abe
1
Parent(s):
52a086f
Fix review schema
Browse files
app/database/models/review.py
CHANGED
|
@@ -69,6 +69,7 @@ class ReviewSchema(BaseSchema):
|
|
| 69 |
property_id: uuid.UUID
|
| 70 |
reviewer_id: uuid.UUID
|
| 71 |
reviewer: Optional["UserSchema"]
|
|
|
|
| 72 |
helpful_votes: list[HelpfulVoteSchema] = []
|
| 73 |
responses: list[ReviewResponseSchema] = []
|
| 74 |
has_voted: Optional[bool] = None
|
|
|
|
| 69 |
property_id: uuid.UUID
|
| 70 |
reviewer_id: uuid.UUID
|
| 71 |
reviewer: Optional["UserSchema"]
|
| 72 |
+
rating: int
|
| 73 |
helpful_votes: list[HelpfulVoteSchema] = []
|
| 74 |
responses: list[ReviewResponseSchema] = []
|
| 75 |
has_voted: Optional[bool] = None
|
app/domains/chat_message/service.py
CHANGED
|
@@ -68,9 +68,9 @@ class ChatMessageService(SQLAlchemyAsyncRepositoryService[ChatMessage]):
|
|
| 68 |
data.session_id = chat_session.id
|
| 69 |
message = await self.create(
|
| 70 |
{
|
| 71 |
-
"content": data.content,
|
| 72 |
"session_id": data.session_id,
|
| 73 |
-
"sender_id": user_id,
|
| 74 |
}
|
| 75 |
)
|
| 76 |
if data.image_list:
|
|
@@ -88,8 +88,9 @@ class ChatMessageService(SQLAlchemyAsyncRepositoryService[ChatMessage]):
|
|
| 88 |
except Exception as e:
|
| 89 |
print(e)
|
| 90 |
await self.repository.session.rollback()
|
|
|
|
| 91 |
finally:
|
| 92 |
-
|
| 93 |
|
| 94 |
async def chat_messages_by_user_id(
|
| 95 |
self, user_1_id: uuid.UUID, user_2_id: uuid.UUID, limit_offset: LimitOffset
|
|
|
|
| 68 |
data.session_id = chat_session.id
|
| 69 |
message = await self.create(
|
| 70 |
{
|
| 71 |
+
"content": data.content if data.content != None else "",
|
| 72 |
"session_id": data.session_id,
|
| 73 |
+
"sender_id": uuid.UUID(user_id),
|
| 74 |
}
|
| 75 |
)
|
| 76 |
if data.image_list:
|
|
|
|
| 88 |
except Exception as e:
|
| 89 |
print(e)
|
| 90 |
await self.repository.session.rollback()
|
| 91 |
+
raise e
|
| 92 |
finally:
|
| 93 |
+
await self.repository.session.commit()
|
| 94 |
|
| 95 |
async def chat_messages_by_user_id(
|
| 96 |
self, user_1_id: uuid.UUID, user_2_id: uuid.UUID, limit_offset: LimitOffset
|