Skip to content

Commit

Permalink
fix: allow non Integers for hoursPerWeek
Browse files Browse the repository at this point in the history
  • Loading branch information
neferin12 committed Aug 30, 2024
1 parent 53c319f commit 9767f6d
Show file tree
Hide file tree
Showing 8 changed files with 44 additions and 9 deletions.
2 changes: 1 addition & 1 deletion client/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
"generateIcons": "yarn dlx vue-pwa-asset-generator --no-manifest -a src/assets/appIcon.png -o public/icons -b \"#FFFFFF\""
},
"dependencies": {
"@educorvi/vue-json-form": "3.0.0-alpha.4",
"@educorvi/vue-json-form": "3.0.0-alpha.5",
"@tsconfig/node-lts": "^18.12.5",
"axios": "^1.7.5",
"bootstrap": "^5.3.3",
Expand Down
2 changes: 2 additions & 0 deletions client/vite.config.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
declare const _default: import("vite").UserConfig;
export default _default;
19 changes: 19 additions & 0 deletions server/migrations/1725025225336-duration_as_decimal.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import { MigrationInterface, QueryRunner } from "typeorm";

export class DurationAsDecimal1725025225336 implements MigrationInterface {
name = 'DurationAsDecimal1725025225336'

public async up(queryRunner: QueryRunner): Promise<void> {

await queryRunner.query(`ALTER TABLE "working_hours" ALTER COLUMN "duration" SET DATA TYPE numeric`);
await queryRunner.query(`CREATE TYPE "public"."contract_data_startmonth_enum" AS ENUM('1', '2', '3', '4', '5', '6', '7', '8', '9', '10', '11', '12')`);
await queryRunner.query(`ALTER TABLE "contract_data" ALTER COLUMN "startMonth" SET DATA TYPE "public"."contract_data_startmonth_enum" USING ("startMonth"::text::contract_data_startmonth_enum)`);
}

public async down(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(`ALTER TABLE "working_hours" ALTER COLUMN "duration" SET DATA TYPE integer`);
await queryRunner.query(`ALTER TABLE "contract_data" ALTER COLUMN "startMonth" SET DATA TYPE integer USING ("startMonth"::integer)`);
await queryRunner.query(`DROP TYPE "public"."contract_data_startmonth_enum"`);
}

}
14 changes: 14 additions & 0 deletions server/migrations/1725025788350-hoursPerWeek_as_decimal.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import { MigrationInterface, QueryRunner } from "typeorm";

export class HoursPerWeekAsDecimal1725025788350 implements MigrationInterface {
name = 'HoursPerWeekAsDecimal1725025788350'

public async up(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(`ALTER TABLE "contract_data" ALTER COLUMN "hoursPerWeek" SET DATA TYPE numeric`);
}

public async down(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(`ALTER TABLE "contract_data" ALTER COLUMN "hoursPerWeek" SET DATA TYPE integer`);
}

}
2 changes: 1 addition & 1 deletion server/src/classes/ContractData.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ export default class ContractData {
/**
* Hours that the user is supposed to work per week
*/
@Column()
@Column("decimal")
hoursPerWeek: number;

/**
Expand Down
2 changes: 1 addition & 1 deletion server/src/classes/WorkingHours.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ export default class WorkingHours {
/**
* The minutes that were worked
*/
@Column()
@Column("decimal")
duration: number;

/**
Expand Down
2 changes: 1 addition & 1 deletion server/src/testing_datasource.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { User, Activity, Task, ContractData, WorkingHours } from './classes';
export const AppDataSource = new DataSource({
type: 'postgres',
host: 'localhost',
username: 'postgres',
username: 'timeclicker',
password: 'superdupertest',
database: 'timeclicker',
entities: [User, Activity, Task, ContractData, WorkingHours],
Expand Down
10 changes: 5 additions & 5 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1625,9 +1625,9 @@ __metadata:
languageName: node
linkType: hard

"@educorvi/vue-json-form@npm:3.0.0-alpha.4":
version: 3.0.0-alpha.4
resolution: "@educorvi/vue-json-form@npm:3.0.0-alpha.4"
"@educorvi/vue-json-form@npm:3.0.0-alpha.5":
version: 3.0.0-alpha.5
resolution: "@educorvi/vue-json-form@npm:3.0.0-alpha.5"
dependencies:
"@apidevtools/json-schema-ref-parser": ^11.6.1
"@educorvi/rita": ^5.1.2
Expand All @@ -1641,7 +1641,7 @@ __metadata:
uuid: ^10.0.0
vue: ^3.4.32
vuedraggable: ^4.1.0
checksum: a2d668677e4f845521abffcdc5c7e037634383bf47914ff2ba4d2302b86fb9705dc4a1479ae8f1c9e75bc56c88fc484cb6537b5064eb2ad04adefc35b813c0b7
checksum: 5c786cf2f223ac6aec004fee09506e3f3d60118e82994c1ef1fa4b53d79842e969a40c87477dd0816dc1896c824de26aae991e09cec4b3c798c7441e955820e7
languageName: node
linkType: hard

Expand Down Expand Up @@ -13146,7 +13146,7 @@ __metadata:
version: 0.0.0-use.local
resolution: "timeclicker_client@workspace:client"
dependencies:
"@educorvi/vue-json-form": 3.0.0-alpha.4
"@educorvi/vue-json-form": 3.0.0-alpha.5
"@iconify-json/bi": ^1.1.23
"@rollup/plugin-url": ^8.0.2
"@rushstack/eslint-patch": ^1.10.2
Expand Down

0 comments on commit 9767f6d

Please sign in to comment.