avoid float in prisma template param
This commit is contained in:
		
							parent
							
								
									e045c46811
								
							
						
					
					
						commit
						dd4806c1a3
					
				@ -200,15 +200,16 @@ export async function onPaid ({ invoice, id }, context) {
 | 
				
			|||||||
    // denormalize ncomments, lastCommentAt, and "weightedComments" for ancestors, and insert into reply table
 | 
					    // denormalize ncomments, lastCommentAt, and "weightedComments" for ancestors, and insert into reply table
 | 
				
			||||||
    await tx.$executeRaw`
 | 
					    await tx.$executeRaw`
 | 
				
			||||||
      WITH comment AS (
 | 
					      WITH comment AS (
 | 
				
			||||||
        SELECT *
 | 
					        SELECT "Item".*, users.trust
 | 
				
			||||||
        FROM "Item"
 | 
					        FROM "Item"
 | 
				
			||||||
        WHERE id = ${item.id}::INTEGER
 | 
					        JOIN users ON "Item"."userId" = users.id
 | 
				
			||||||
 | 
					        WHERE "Item".id = ${item.id}::INTEGER
 | 
				
			||||||
      ), ancestors AS (
 | 
					      ), ancestors AS (
 | 
				
			||||||
        UPDATE "Item"
 | 
					        UPDATE "Item"
 | 
				
			||||||
        SET ncomments = "Item".ncomments + 1,
 | 
					        SET ncomments = "Item".ncomments + 1,
 | 
				
			||||||
          "lastCommentAt" = now(),
 | 
					          "lastCommentAt" = now(),
 | 
				
			||||||
          "weightedComments" = "Item"."weightedComments" +
 | 
					          "weightedComments" = "Item"."weightedComments" +
 | 
				
			||||||
            CASE WHEN comment."userId" = "Item"."userId" THEN 0 ELSE ${item.user.trust}::FLOAT END
 | 
					            CASE WHEN comment."userId" = "Item"."userId" THEN 0 ELSE comment.trust END
 | 
				
			||||||
        FROM comment
 | 
					        FROM comment
 | 
				
			||||||
        WHERE "Item".path @> comment.path AND "Item".id <> comment.id
 | 
					        WHERE "Item".path @> comment.path AND "Item".id <> comment.id
 | 
				
			||||||
        RETURNING "Item".*
 | 
					        RETURNING "Item".*
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user