Conversation
Further fixes for /v6/my-reviews for big accounts
| rv."resourceId", | ||
| COUNT(*) AS "pendingAppealCount", | ||
| now() | ||
| FROM reviews.review rv |
There was a problem hiding this comment.
[correctness]
The now() function is used multiple times in the SQL statements. Consider using a single variable to store the current timestamp to ensure consistency across the transaction, especially if the transaction takes a non-trivial amount of time to execute.
| AFTER INSERT OR UPDATE OR DELETE ON reviews."appealResponse" | ||
| FOR EACH ROW | ||
| EXECUTE FUNCTION reviews.handle_appeal_response_change(); | ||
|
|
There was a problem hiding this comment.
[💡 style]
There is no newline at the end of the file. While this is a minor issue, it is generally a good practice to include a newline at the end of files to avoid potential issues with some tools and to adhere to POSIX standards.
| } | ||
|
|
||
| model reviewPendingSummary { | ||
| resourceId String @id |
There was a problem hiding this comment.
[maintainability]
Consider adding a @db.VarChar annotation to resourceId to explicitly define its length in the database schema. This can help prevent potential issues with varying string lengths across different database systems.
| hasIncompleteReviews: boolean | null; | ||
| incompletePhaseName: string | null; | ||
| hasPendingAppealResponses: boolean | null; | ||
| hasPendingAppealResponses: boolean; |
There was a problem hiding this comment.
[❗❗ correctness]
The type change from boolean | null to boolean for hasPendingAppealResponses may introduce issues if the previous logic depended on distinguishing between false and null. Ensure that the rest of the codebase correctly handles this change.
| deliverable_reviews."hasIncompleteReviews" AS "hasIncompleteReviews", | ||
| deliverable_reviews."incompletePhaseName" AS "incompletePhaseName", | ||
| pending_appeals."hasPendingAppealResponses" AS "hasPendingAppealResponses", | ||
| COALESCE(pending_appeals."pendingAppealCount" > 0, FALSE) AS "hasPendingAppealResponses", |
There was a problem hiding this comment.
[correctness]
The use of COALESCE(pending_appeals."pendingAppealCount" > 0, FALSE) assumes that pendingAppealCount is always non-null. If pendingAppealCount can be null, this logic may not behave as expected. Consider verifying the nullability of pendingAppealCount.
No description provided.