feat(web+server): map date filters + small changes (#2565)

This commit is contained in:
Michel Heusschen
2023-05-25 18:47:52 +02:00
committed by GitHub
parent bcc2c34eef
commit 062e2eca6f
18 changed files with 429 additions and 178 deletions

View File

@@ -0,0 +1,15 @@
import { Between, LessThanOrEqual, MoreThanOrEqual } from 'typeorm';
/**
* Allows optional values unlike the regular Between and uses MoreThanOrEqual
* or LessThanOrEqual when only one parameter is specified.
*/
export default function OptionalBetween<T>(from?: T, to?: T) {
if (from && to) {
return Between(from, to);
} else if (from) {
return MoreThanOrEqual(from);
} else if (to) {
return LessThanOrEqual(to);
}
}