@@ -153,7 +153,7 @@ export async function dbSetUserState(
153153type DbQuestionElement = ( typeof e . Question ) [ "__element__" ] ;
154154type DbQuestionElementQueryShape = Readonly <
155155 objectTypeToSelectShape < DbQuestionElement > &
156- SelectModifiers < DbQuestionElement >
156+ SelectModifiers < DbQuestionElement >
157157> ;
158158
159159const questionQueryFields = {
@@ -197,7 +197,9 @@ export async function dbFetchCurrentQuestionData(roomId: string) {
197197 const questions = await e
198198 . select ( e . Question , ( question ) => ( {
199199 ...questionQueryFields ,
200- filter : e . any ( e . op ( question [ "<questions[is Room]" ] . id , "=" , e . uuid ( roomId ) ) ) ,
200+ filter : e . any (
201+ e . op ( question [ "<questions[is Room]" ] . id , "=" , e . uuid ( roomId ) ) ,
202+ ) ,
201203 order_by : { expression : question . createdAt , direction : e . DESC } ,
202204 limit : 1 ,
203205 } ) )
@@ -211,7 +213,9 @@ export async function dbFetchAllQuestionsData(roomId: string) {
211213 const questions = await e
212214 . select ( e . Question , ( question ) => ( {
213215 ...questionQueryFields ,
214- filter : e . any ( e . op ( question [ "<questions[is Room]" ] . id , "=" , e . uuid ( roomId ) ) ) ,
216+ filter : e . any (
217+ e . op ( question [ "<questions[is Room]" ] . id , "=" , e . uuid ( roomId ) ) ,
218+ ) ,
215219 } ) )
216220 . run ( dbClient ) ;
217221
@@ -225,29 +229,33 @@ function dbQuestionInteractAndResetVotesPartialQuery(
225229 const deletedSingleVote = e . delete (
226230 e . SingleCandidateVote ,
227231 ( singleCandidateVote ) => ( {
228- filter : e . op (
232+ filter : e . any (
229233 e . op (
230- singleCandidateVote . candidate [ "<candidates[is Question]" ] . id ,
231- "=" ,
232- e . uuid ( questionId ) ,
234+ e . op (
235+ singleCandidateVote . candidate [ "<candidates[is Question]" ] . id ,
236+ "=" ,
237+ e . uuid ( questionId ) ,
238+ ) ,
239+ "and" ,
240+ e . op ( singleCandidateVote . voter . id , "=" , e . uuid ( userId ) ) ,
233241 ) ,
234- "and" ,
235- e . op ( singleCandidateVote . voter . id , "=" , e . uuid ( userId ) ) ,
236242 ) ,
237243 } ) ,
238244 ) ;
239245
240246 const deletedPreferentialVote = e . delete (
241247 e . PreferentialCandidateVote ,
242248 ( preferentialCandidateVote ) => ( {
243- filter : e . op (
249+ filter : e . any (
244250 e . op (
245- preferentialCandidateVote . candidate [ "<candidates[is Question]" ] . id ,
246- "=" ,
247- e . uuid ( questionId ) ,
251+ e . op (
252+ preferentialCandidateVote . candidate [ "<candidates[is Question]" ] . id ,
253+ "=" ,
254+ e . uuid ( questionId ) ,
255+ ) ,
256+ "and" ,
257+ e . op ( preferentialCandidateVote . voter . id , "=" , e . uuid ( userId ) ) ,
248258 ) ,
249- "and" ,
250- e . op ( preferentialCandidateVote . voter . id , "=" , e . uuid ( userId ) ) ,
251259 ) ,
252260 } ) ,
253261 ) ;
0 commit comments