Skip to content

Commit

Permalink
fix(jobs): types and get job service
Browse files Browse the repository at this point in the history
  • Loading branch information
RemiBonnet committed Dec 2, 2022
1 parent a6d20ce commit ea6c061
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 9 deletions.
7 changes: 3 additions & 4 deletions libs/shared/enums/src/lib/utils/get-service-type.ts
@@ -1,4 +1,3 @@
import { JobScheduleEvent } from 'qovery-typescript-axios'
import {
ApplicationEntity,
ContainerApplicationEntity,
Expand All @@ -11,15 +10,15 @@ import { ServiceTypeEnum } from '../service-type.enum'
export const getServiceType = (data: ApplicationEntity | DatabaseEntity) => {
let currentType: ServiceTypeEnum

const isJob = (data as JobApplicationEntity).max_nb_restart
const isJob = (data as JobApplicationEntity).max_nb_restart !== undefined

if ((data as ContainerApplicationEntity).image_name) {
currentType = ServiceTypeEnum.CONTAINER
} else if (!(data as GitApplicationEntity).build_mode && !(data as ContainerApplicationEntity).image_name && !isJob) {
currentType = ServiceTypeEnum.DATABASE
} else if (isJob && (data as JobApplicationEntity).schedule?.event !== JobScheduleEvent.CRON) {
} else if (isJob && (data as JobApplicationEntity).schedule?.cronjob) {
currentType = ServiceTypeEnum.CRON_JOB
} else if (isJob && (data as JobApplicationEntity).schedule?.event === JobScheduleEvent.CRON) {
} else if (isJob && !(data as JobApplicationEntity).schedule?.cronjob) {
currentType = ServiceTypeEnum.LIFECYCLE_JOB
} else {
currentType = ServiceTypeEnum.APPLICATION
Expand Down
2 changes: 1 addition & 1 deletion package.json
Expand Up @@ -53,7 +53,7 @@
"msw": "^0.42.1",
"postcss": "8.4.16",
"posthog-js": "^1.24.0",
"qovery-typescript-axios": "^1.1.47",
"qovery-typescript-axios": "^1.1.53",
"react": "18.2.0",
"react-beautiful-dnd": "^13.1.0",
"react-dom": "18.2.0",
Expand Down
8 changes: 4 additions & 4 deletions yarn.lock
Expand Up @@ -16535,10 +16535,10 @@ q@^1.5.1:
resolved "https://registry.yarnpkg.com/q/-/q-1.5.1.tgz#7e32f75b41381291d04611f1bf14109ac00651d7"
integrity sha512-kV/CThkXo6xyFEZUugw/+pIOywXcDbFYgSct5cT3gqlbkBE1SJdwy6UQoZvodiWF/ckQLZyDE/Bu1M6gVu5lVw==

qovery-typescript-axios@^1.1.47:
version "1.1.47"
resolved "https://registry.yarnpkg.com/qovery-typescript-axios/-/qovery-typescript-axios-1.1.47.tgz#bf490180bc946ea52b1b9a3a55b3b11cf4393462"
integrity sha512-CXL3vlJe5rcJvhtLWSQqqkShlLKQquI5BFfqhPPsKS8ircajTbGWOZlovWO8k9Ej5o06mDGsw9YKK4ACTaiArg==
qovery-typescript-axios@^1.1.53:
version "1.1.53"
resolved "https://registry.yarnpkg.com/qovery-typescript-axios/-/qovery-typescript-axios-1.1.53.tgz#01946045441fa54ae35abce5fee9dd3ec0a96be7"
integrity sha512-mKX0HRFwt/7bLN5rlnwUKvNdPhz7J5ylY5bQc7ZvmP4gvV9pJNrOsAhGLEOxihXeEwAFpSHN4mTJsqdneBO+zg==
dependencies:
axios "^0.21.4"

Expand Down

0 comments on commit ea6c061

Please sign in to comment.