mirror of
https://github.com/directus/directus.git
synced 2026-01-28 21:28:10 -05:00
Replace knex.fn.now() in DB queries (#10736)
This commit is contained in:
@@ -275,12 +275,12 @@ export class AuthenticationService {
|
||||
.leftJoin('directus_shares AS d', 's.share', 'd.id')
|
||||
.joinRaw('LEFT JOIN directus_roles AS r ON r.id IN (u.role, d.role)')
|
||||
.where('s.token', refreshToken)
|
||||
.andWhere('s.expires', '>=', this.knex.fn.now())
|
||||
.andWhere('s.expires', '>=', new Date())
|
||||
.andWhere((subQuery) => {
|
||||
subQuery.whereNull('d.date_end').orWhere('d.date_end', '>=', this.knex.fn.now());
|
||||
subQuery.whereNull('d.date_end').orWhere('d.date_end', '>=', new Date());
|
||||
})
|
||||
.andWhere((subQuery) => {
|
||||
subQuery.whereNull('d.date_start').orWhere('d.date_start', '<=', this.knex.fn.now());
|
||||
subQuery.whereNull('d.date_start').orWhere('d.date_start', '<=', new Date());
|
||||
})
|
||||
.first();
|
||||
|
||||
|
||||
@@ -54,10 +54,10 @@ export class SharesService extends ItemsService {
|
||||
.from('directus_shares')
|
||||
.where('id', payload.share)
|
||||
.andWhere((subQuery) => {
|
||||
subQuery.whereNull('date_end').orWhere('date_end', '>=', this.knex.fn.now());
|
||||
subQuery.whereNull('date_end').orWhere('date_end', '>=', new Date());
|
||||
})
|
||||
.andWhere((subQuery) => {
|
||||
subQuery.whereNull('date_start').orWhere('date_start', '<=', this.knex.fn.now());
|
||||
subQuery.whereNull('date_start').orWhere('date_start', '<=', new Date());
|
||||
})
|
||||
.andWhere((subQuery) => {
|
||||
subQuery.whereNull('max_uses').orWhere('max_uses', '>=', this.knex.ref('times_used'));
|
||||
|
||||
Reference in New Issue
Block a user