Skip to content

Commit

Permalink
Merge branch 'master' into develop
Browse files Browse the repository at this point in the history
  • Loading branch information
genouf committed Oct 11, 2023
2 parents daca638 + cd6c76e commit 034b691
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 3 deletions.
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,13 @@

All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.

## [1.1.0](https://github.com/teamstarter/graphql-node-jobs/compare/v1.0.0...v1.1.0) (2023-10-11)


### Features

* **jobSuccess:** new materialized view about jobSuccess ([#77](https://github.com/teamstarter/graphql-node-jobs/issues/77)) ([d464793](https://github.com/teamstarter/graphql-node-jobs/commit/d4647938e499c7c8131a3344a1d97f401f10b59a))

## [1.0.0](https://github.com/teamstarter/graphql-node-jobs/compare/v0.5.3...v1.0.0) (2023-01-31)


Expand Down
23 changes: 23 additions & 0 deletions migrations/20230829170707-add-jobSuccess-materialized-view.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
const sequelize = require('sequelize')

module.exports = {
up: async function (queryInterface, Sequelize) {
sequelize.queryInterface.query(`
CREATE MATERIALIZED VIEW IF NOT EXISTS "jobSuccess" as
SELECT
TO_CHAR(DATE_TRUNC('day', j."createdAt"), 'DD/MM/YY') AS "day",
ROUND(
(SUM(CASE WHEN j."status" = 'successful' THEN 1 ELSE 0 END) * 100.0) /
NULLIF(SUM(CASE WHEN j."status" IN ('successful', 'failed') THEN 1 ELSE 0 END), 0)
)::INTEGER AS "successRating"
FROM
job j
WHERE
j."status" IN ('successful', 'failed')
GROUP BY
DATE_TRUNC('day', j."createdAt")
ORDER BY
DATE_TRUNC('day', j."createdAt");`)
},
down: function () {},
}
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "graphql-node-jobs",
"version": "1.0.0",
"name": "@teamstarter/graphql-node-jobs",
"version": "1.1.0",
"private": false,
"author": {
"email": "vincent.desmares@gmail.com",
Expand Down Expand Up @@ -57,7 +57,7 @@
"graphql": "^16.6.0",
"graphql-relay": "^0.10.0",
"graphql-sequelize": "^9.5.1",
"graphql-sequelize-generator": "teamstarter/graphql-sequelize-generator#upgrade-apollo-10-2022",
"graphql-sequelize-generator": "teamstarter/graphql-sequelize-generator",
"jest": "^24.9.0",
"pm2": "^4.2.1",
"react": "^18.2.0",
Expand Down

0 comments on commit 034b691

Please sign in to comment.