Skip to content

Rallly is an open-source scheduling and collaboration tool designed to make organizing events and meetings easier.

Add house keeping workflow

Luke Vella00cf0827b4a5
diff --git a/.github/workflows/house-keeping.yml b/.github/workflows/house-keeping.yml
new file mode 100644
index 000000000..d6d03cc29
--- /dev/null
+++ b/.github/workflows/house-keeping.yml
@@ -0,0 +1,21 @@
+name: House Keeping
+on:
+ workflow_dispatch:
+ inputs:
+ query:
+ description: "Query params for house keeping endpoint"
+ required: false
+ # schedule:
+ # - cron: "0 6 * * *" # Every day at 6:00am UTC
+
+jobs:
+ clean:
+ name: "Clean"
+ runs-on: ubuntu-latest
+ steps:
+ - name: Call house keeping
+ env:
+ API_SECRET: ${{ secrets.API_SECRET }}
+ run: |
+ curl -X "POST" --fail "https://rallly.co/api/house-keeping${{ github.event.inputs.query }}" \
+ -H "Authorization: Bearer ${API_SECRET}"
diff --git a/prisma/middlewares/softDeleteMiddleware.ts b/prisma/middlewares/softDeleteMiddleware.ts
index 85f53f952..dbb4ef336 100644
--- a/prisma/middlewares/softDeleteMiddleware.ts
+++ b/prisma/middlewares/softDeleteMiddleware.ts
@@ -31,17 +31,6 @@ export const softDeleteMiddleware = (
// ID filter maintained
params.args.where["deleted"] = false;
}
- if (params.action === "findMany") {
- // Find many queries
- if (params.args.where) {
- if (params.args.where.deleted == undefined) {
- // Exclude deleted records if they have not been explicitly requested
- params.args.where["deleted"] = false;
- }
- } else {
- params.args["where"] = { deleted: false };
- }
- }
}
return next(params);
});
diff --git a/src/pages/api/house-keeping.ts b/src/pages/api/house-keeping.ts
index ed69ab7f4..106be6361 100644
--- a/src/pages/api/house-keeping.ts
+++ b/src/pages/api/house-keeping.ts
@@ -28,9 +28,8 @@ export default async function handler(
: NaN;
// If not specified we default to a max of 500 polls
- const batchSize = !isNaN(parsedBatchSizeQueryParam)
- ? parsedBatchSizeQueryParam
- : 500;
+ const batchSize =
+ parsedBatchSizeQueryParam > 0 ? parsedBatchSizeQueryParam : 500;
const { authorization } = req.headers;