File tree Expand file tree Collapse file tree 1 file changed +34
-14
lines changed Expand file tree Collapse file tree 1 file changed +34
-14
lines changed Original file line number Diff line number Diff line change @@ -81,13 +81,23 @@ export async function getWaitingOpening(userLogin: string) {
81
81
where : {
82
82
date : null ,
83
83
code : { not : null } ,
84
- OR : [ { borrow : { userLogin } } , { return : { userLogin } } ] ,
85
- borrow : {
86
- OR : [
87
- null ,
88
- { createdAt : { gte : new Date ( Date . now ( ) - BORROW_TIMEOUT ) } } ,
89
- ] ,
90
- } ,
84
+ AND : [
85
+ {
86
+ OR : [ { borrow : { userLogin } } , { return : { userLogin } } ] ,
87
+ } ,
88
+ {
89
+ OR : [
90
+ {
91
+ borrow : null ,
92
+ } ,
93
+ {
94
+ borrow : {
95
+ createdAt : { gte : new Date ( Date . now ( ) - BORROW_TIMEOUT ) } ,
96
+ } ,
97
+ } ,
98
+ ] ,
99
+ } ,
100
+ ] ,
91
101
} ,
92
102
...OPENING_INCLUDE_BEFORE_FORMATTING ,
93
103
} ) ;
@@ -98,13 +108,23 @@ export async function getWaitingOpeningWithValidCode(userLogin: string) {
98
108
const opening = await prisma . opening . findFirst ( {
99
109
where : {
100
110
...prismaUtils . validOpening ,
101
- OR : [ { borrow : { userLogin } } , { return : { userLogin } } ] ,
102
- borrow : {
103
- OR : [
104
- null ,
105
- { createdAt : { gte : new Date ( Date . now ( ) - BORROW_TIMEOUT ) } } ,
106
- ] ,
107
- } ,
111
+ AND : [
112
+ {
113
+ OR : [ { borrow : { userLogin } } , { return : { userLogin } } ] ,
114
+ } ,
115
+ {
116
+ OR : [
117
+ {
118
+ borrow : null ,
119
+ } ,
120
+ {
121
+ borrow : {
122
+ createdAt : { gte : new Date ( Date . now ( ) - BORROW_TIMEOUT ) } ,
123
+ } ,
124
+ } ,
125
+ ] ,
126
+ } ,
127
+ ] ,
108
128
} ,
109
129
...OPENING_INCLUDE_BEFORE_FORMATTING ,
110
130
} ) ;
You can’t perform that action at this time.
0 commit comments