-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: probe adoption expiration (#36)
Co-authored-by: Martin Kolárik <[email protected]>
- Loading branch information
1 parent
4d6fdd1
commit 6d86359
Showing
21 changed files
with
6,658 additions
and
112 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
version: 1 | ||
directus: 10.12.1 | ||
directus: 11.1.1 | ||
vendor: mysql | ||
collections: | ||
- collection: gp_adopted_probes | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
28 changes: 28 additions & 0 deletions
28
src/extensions/migrations/20241028GP-add-remove-offline-probes-cron-handler.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
import { randomUUID } from 'node:crypto'; | ||
import { createFlow, createOperation, assignOperationToFlow } from '../migration-utils.js'; | ||
|
||
export async function up () { | ||
const flowId = randomUUID(); // Flow id needs to be a uuid, as Directus throws otherwise. This is a random value. | ||
|
||
await createFlow(flowId, { | ||
name: 'Expired probes CRON', | ||
description: 'Removes expired probe adoptions from directus', | ||
trigger: 'schedule', | ||
options: { | ||
cron: '0 0 * * *', | ||
}, | ||
}); | ||
|
||
const operation = await createOperation(flowId, { | ||
name: 'Remove expired adoptions CRON handler', | ||
key: 'remove_expired_adoptions_cron_handler', | ||
type: 'remove-expired-adoptions-cron-handler', | ||
}); | ||
|
||
await assignOperationToFlow(flowId, operation.id); | ||
console.log('Expired probes CRON handler added'); | ||
} | ||
|
||
export async function down () { | ||
console.log('There is no down operation for that migration.'); | ||
} |
2 changes: 1 addition & 1 deletion
2
src/extensions/operations/adopted-probes-credits-cron-handler/src/repositories/directus.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
src/extensions/operations/adopted-probes-status-cron-handler/src/repositories/directus.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
3 changes: 3 additions & 0 deletions
3
src/extensions/operations/remove-expired-adoptions-cron-handler/.gitignore
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
.DS_Store | ||
node_modules | ||
dist |
11 changes: 11 additions & 0 deletions
11
src/extensions/operations/remove-expired-adoptions-cron-handler/.mocharc.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
{ | ||
"extension": [ | ||
"ts" | ||
], | ||
"node-option": [ | ||
"experimental-specifier-resolution=node", | ||
"loader=ts-node/esm", | ||
"no-experimental-fetch" | ||
], | ||
"spec": "test/**/*.ts" | ||
} |
Oops, something went wrong.