Browse Source

feat(AdvancedTable): Lesser/Greater than or equal to filter types

Owen Diffey 3 years ago
parent
commit
028df4f0e8

+ 4 - 0
backend/logic/actions/dataRequests.js

@@ -54,10 +54,14 @@ export default {
 							newQuery[filter.property] = { $lte: new Date(data) };
 						} else if (filterType === "datetimeAfter") {
 							newQuery[filter.property] = { $gte: new Date(data) };
+						} else if (filterType === "numberLesserEqual") {
+							newQuery[filter.property] = { $lte: data };
 						} else if (filterType === "numberLesser") {
 							newQuery[filter.property] = { $lt: data };
 						} else if (filterType === "numberGreater") {
 							newQuery[filter.property] = { $gt: data };
+						} else if (filterType === "numberGreaterEqual") {
+							newQuery[filter.property] = { $gte: data };
 						} else if (filterType === "numberEquals") {
 							newQuery[filter.property] = { $eq: data };
 						}

+ 4 - 0
backend/logic/actions/news.js

@@ -90,10 +90,14 @@ export default {
 							newQuery[filter.property] = { $lte: new Date(data) };
 						} else if (filterType === "datetimeAfter") {
 							newQuery[filter.property] = { $gte: new Date(data) };
+						} else if (filterType === "numberLesserEqual") {
+							newQuery[filter.property] = { $lte: data };
 						} else if (filterType === "numberLesser") {
 							newQuery[filter.property] = { $lt: data };
 						} else if (filterType === "numberGreater") {
 							newQuery[filter.property] = { $gt: data };
+						} else if (filterType === "numberGreaterEqual") {
+							newQuery[filter.property] = { $gte: data };
 						} else if (filterType === "numberEquals") {
 							newQuery[filter.property] = { $eq: data };
 						}

+ 4 - 0
backend/logic/actions/punishments.js

@@ -61,10 +61,14 @@ export default {
 							newQuery[filter.property] = { $lte: new Date(data) };
 						} else if (filterType === "datetimeAfter") {
 							newQuery[filter.property] = { $gte: new Date(data) };
+						} else if (filterType === "numberLesserEqual") {
+							newQuery[filter.property] = { $lte: data };
 						} else if (filterType === "numberLesser") {
 							newQuery[filter.property] = { $lt: data };
 						} else if (filterType === "numberGreater") {
 							newQuery[filter.property] = { $gt: data };
+						} else if (filterType === "numberGreaterEqual") {
+							newQuery[filter.property] = { $gte: data };
 						} else if (filterType === "numberEquals") {
 							newQuery[filter.property] = { $eq: data };
 						}

+ 4 - 0
backend/logic/actions/reports.js

@@ -93,10 +93,14 @@ export default {
 							newQuery[filter.property] = { $lte: new Date(data) };
 						} else if (filterType === "datetimeAfter") {
 							newQuery[filter.property] = { $gte: new Date(data) };
+						} else if (filterType === "numberLesserEqual") {
+							newQuery[filter.property] = { $lte: data };
 						} else if (filterType === "numberLesser") {
 							newQuery[filter.property] = { $lt: data };
 						} else if (filterType === "numberGreater") {
 							newQuery[filter.property] = { $gt: data };
+						} else if (filterType === "numberGreaterEqual") {
+							newQuery[filter.property] = { $gte: data };
 						} else if (filterType === "numberEquals") {
 							newQuery[filter.property] = { $eq: data };
 						}

+ 4 - 0
backend/logic/actions/users.js

@@ -203,10 +203,14 @@ export default {
 							newQuery[filter.property] = { $lte: new Date(data) };
 						} else if (filterType === "datetimeAfter") {
 							newQuery[filter.property] = { $gte: new Date(data) };
+						} else if (filterType === "numberLesserEqual") {
+							newQuery[filter.property] = { $lte: data };
 						} else if (filterType === "numberLesser") {
 							newQuery[filter.property] = { $lt: data };
 						} else if (filterType === "numberGreater") {
 							newQuery[filter.property] = { $gt: data };
+						} else if (filterType === "numberGreaterEqual") {
+							newQuery[filter.property] = { $gte: data };
 						} else if (filterType === "numberEquals") {
 							newQuery[filter.property] = { $eq: data };
 						} else if (filterType === "array") {

+ 4 - 0
backend/logic/playlists.js

@@ -904,10 +904,14 @@ class _PlaylistsModule extends CoreClass {
 								newQuery[filter.property] = { $lte: new Date(data) };
 							} else if (filterType === "datetimeAfter") {
 								newQuery[filter.property] = { $gte: new Date(data) };
+							} else if (filterType === "numberLesserEqual") {
+								newQuery[filter.property] = { $lte: data };
 							} else if (filterType === "numberLesser") {
 								newQuery[filter.property] = { $lt: data };
 							} else if (filterType === "numberGreater") {
 								newQuery[filter.property] = { $gt: data };
+							} else if (filterType === "numberGreaterEqual") {
+								newQuery[filter.property] = { $gte: data };
 							} else if (filterType === "numberEquals") {
 								newQuery[filter.property] = { $eq: data };
 							} else if (filterType === "array") {

+ 4 - 0
backend/logic/songs.js

@@ -242,10 +242,14 @@ class _SongsModule extends CoreClass {
 								newQuery[filter.property] = { $lte: new Date(data) };
 							} else if (filterType === "datetimeAfter") {
 								newQuery[filter.property] = { $gte: new Date(data) };
+							} else if (filterType === "numberLesserEqual") {
+								newQuery[filter.property] = { $lte: data };
 							} else if (filterType === "numberLesser") {
 								newQuery[filter.property] = { $lt: data };
 							} else if (filterType === "numberGreater") {
 								newQuery[filter.property] = { $gt: data };
+							} else if (filterType === "numberGreaterEqual") {
+								newQuery[filter.property] = { $gte: data };
 							} else if (filterType === "numberEquals") {
 								newQuery[filter.property] = { $eq: data };
 							} else if (filterType === "array") {

+ 4 - 0
backend/logic/stations.js

@@ -427,10 +427,14 @@ class _StationsModule extends CoreClass {
 								newQuery[filter.property] = { $lte: new Date(data) };
 							} else if (filterType === "datetimeAfter") {
 								newQuery[filter.property] = { $gte: new Date(data) };
+							} else if (filterType === "numberLesserEqual") {
+								newQuery[filter.property] = { $lte: data };
 							} else if (filterType === "numberLesser") {
 								newQuery[filter.property] = { $lt: data };
 							} else if (filterType === "numberGreater") {
 								newQuery[filter.property] = { $gt: data };
+							} else if (filterType === "numberGreaterEqual") {
+								newQuery[filter.property] = { $gte: data };
 							} else if (filterType === "numberEquals") {
 								newQuery[filter.property] = { $eq: data };
 							} else if (filterType === "array") {

+ 11 - 3
frontend/src/components/AdvancedTable.vue

@@ -775,17 +775,25 @@ export default {
 					name: "datetimeAfter",
 					displayName: "After"
 				},
+				numberLesserEqual: {
+					name: "numberLesserEqual",
+					displayName: "<="
+				},
 				numberLesser: {
 					name: "numberLesser",
-					displayName: "Less than"
+					displayName: "<"
 				},
 				numberGreater: {
 					name: "numberGreater",
-					displayName: "Greater than"
+					displayName: ">"
+				},
+				numberGreaterEqual: {
+					name: "numberGreaterEqual",
+					displayName: ">="
 				},
 				numberEquals: {
 					name: "numberEquals",
-					displayName: "Equals"
+					displayName: "=="
 				},
 				array: {
 					name: "array",

+ 8 - 0
frontend/src/pages/Admin/tabs/Songs.vue

@@ -555,8 +555,10 @@ export default {
 					displayName: "Likes",
 					property: "likes",
 					filterTypes: [
+						"numberLesserEqual",
 						"numberLesser",
 						"numberGreater",
+						"numberGreaterEqual",
 						"numberEquals",
 						"exact",
 						"regex"
@@ -568,8 +570,10 @@ export default {
 					displayName: "Dislikes",
 					property: "dislikes",
 					filterTypes: [
+						"numberLesserEqual",
 						"numberLesser",
 						"numberGreater",
+						"numberGreaterEqual",
 						"numberEquals",
 						"exact",
 						"regex"
@@ -581,8 +585,10 @@ export default {
 					displayName: "Duration",
 					property: "duration",
 					filterTypes: [
+						"numberLesserEqual",
 						"numberLesser",
 						"numberGreater",
+						"numberGreaterEqual",
 						"numberEquals",
 						"exact",
 						"regex"
@@ -594,8 +600,10 @@ export default {
 					displayName: "Skip Duration",
 					property: "skipDuration",
 					filterTypes: [
+						"numberLesserEqual",
 						"numberLesser",
 						"numberGreater",
+						"numberGreaterEqual",
 						"numberEquals",
 						"exact",
 						"regex"

+ 2 - 0
frontend/src/pages/Admin/tabs/Users.vue

@@ -411,8 +411,10 @@ export default {
 						displayName: "Songs Requested",
 						property: "statistics.songsRequested",
 						filterTypes: [
+							"numberLesserEqual",
 							"numberLesser",
 							"numberGreater",
+							"numberGreaterEqual",
 							"numberEquals",
 							"exact",
 							"regex"