Skip to content

Commit

Permalink
fix: relax zod types to avoid breaking everytime
Browse files Browse the repository at this point in the history
  • Loading branch information
DanielRamosAcosta committed Jun 4, 2024
1 parent aa87937 commit aa7fabb
Show file tree
Hide file tree
Showing 7 changed files with 2 additions and 113 deletions.
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "factorial-cli",
"version": "1.0.8",
"version": "1.0.9",
"type": "module",
"description": "Fill your factorial shifts with ease",
"main": "dist/src/infrastructure/cli/main.js",
Expand Down Expand Up @@ -33,4 +33,4 @@
"yargs": "^17.7.2",
"zod": "^3.22.4"
}
}
}
3 changes: 0 additions & 3 deletions src/infrastructure/factorial-client/schema/CalendarDay.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,8 @@ import { z } from "zod";
import { Leave } from "./Leave.js";

export const CalendarDay = z.object({
id: z.string(),
day: z.number(),
date: z.string(),
isLaborable: z.boolean(),
isLeave: z.boolean(),
leaves: z.array(Leave),
});

Expand Down
30 changes: 0 additions & 30 deletions src/infrastructure/factorial-client/schema/Employee.ts
Original file line number Diff line number Diff line change
@@ -1,37 +1,7 @@
import { z } from "zod";

export const Employee = z.object({
accessId: z.number(),
attendable: z.boolean(),
attendanceEmployeesPolicyId: z.number(),
attendanceEmployeesSettingId: z.number(),
contractId: z.string().nullable(),
employeeGroupId: z.number(),
fiscalCountry: z.string(),
hasRegularAccess: z.boolean(),
id: z.number(),
irpf: z.number().nullable(),
isEligibleForPayroll: z.boolean(),
isTerminating: z.boolean(),
jobTitle: z.string().nullable(),
legalEntityCurrency: z.enum(["EUR"]),
locationId: z.number(),
managedByCurrent: z.boolean(),
managerId: z.number().nullable(),
paymentFrequency: z.enum(["monthly"]),
payrollHiringId: z.number(),
preferredName: z.string().nullable(),
pronouns: z.string().nullable(),
regularAccessStartsOn: z.string().nullable(),
showBirthday: z.boolean().optional(),
supervisedByCurrent: z.boolean(),
tenureStartDate: z.string().nullable(),
terminatedOn: z.string().nullable(),
terminationReasonType: z.string().nullable(),
terminationTypeDescription: z.string().nullable(),
timeoffManagerId: z.number().nullable(),
timeoffPolicyId: z.number(),
timeoffSupervisedByCurrent: z.boolean(),
});

export type Employee = z.infer<typeof Employee>;
2 changes: 0 additions & 2 deletions src/infrastructure/factorial-client/schema/Leave.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
import { z } from "zod";

export const Leave = z.object({
halfDay: z.null(),
color: z.string(),
name: z.string(),
});

Expand Down
30 changes: 0 additions & 30 deletions src/infrastructure/factorial-client/schema/MySelf.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,37 +2,7 @@ import { Employee } from "./Employee.js";
import { z } from "zod";

export const MySelf = Employee.extend({
country: z.enum(["es"]),
state: z.string(),
postalCode: z.string(),
city: z.string(),
addressLine1: z.string(),
addressLine2: z.string().nullable(),
countryMetadata: z.object({
id: z.number(),
irpfInCents: z.number().nullable(),
socialSecurityNumber: z.string().nullable(),
hasWorkPermit: z.boolean().nullable(),
}),
contactName: z.string().nullable(),
contactNumber: z.string().nullable(),
phoneNumber: z.string(),
hiredOn: z.string().nullable(),
identifier: z.string(),
identifierType: z.enum(["dni"]),
gender: z.string(),
nationality: z.enum(["es"]),
birthdayOn: z.string(),
bankNumber: z.string(),
swiftBic: z.string().nullable(),
bankNumberFormat: z.string().nullable(),
companyIdentifier: z.string().nullable(),
baseCompensationType: z.string().nullable(),
baseCompensationAmountInCents: z.number().nullable(),
terminatedOn: z.string().nullable(),
isTerminating: z.boolean(),
terminationReasonType: z.string().nullable(),
terminationTypeDescription: z.string().nullable(),
});

export type MySelf = z.infer<typeof MySelf>;
Expand Down
31 changes: 0 additions & 31 deletions src/infrastructure/factorial-client/schema/Period.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,35 +2,4 @@ import { z } from "zod";

export const Period = z.object({
id: z.number(),
employeeId: z.number(),
year: z.number(),
month: z.number(),
startOn: z.string(),
endOn: z.string(),
state: z.string(),
timeUnitsDistibution: z.array(z.string()),
workedMinutes: z.number(),
trackedMinutes: z.number(),
trackedMinutesDistribution: z.array(z.number()),
distribution: z.array(z.number()),
workedMinutesNotApprovedDistribution: z.array(z.number()),
totalBreakTaken: z.array(z.boolean()).optional(),
balanceMinutes: z.string(),
balanceMinutesDistribution: z.array(z.number()),
estimatedMinutes: z.number(),
estimatedRegularMinutes: z.number(),
estimatedRegularMinutesDistribution: z.array(z.number()),
estimatedOvertimeMinutes: z.number(),
estimatedMinutesUntilToday: z.number(),
estimatedMinutesDistribution: z.array(z.number()),
estimatedOvertimeMinutesDistribution: z.array(z.number()),
estimatedOvertimeRequestMinutesDistribution: z.array(z.number()),
workedHalfDays: z.number(),
permissions: z.object({
read: z.boolean(),
edit: z.boolean(),
approve: z.boolean(),
delete: z.boolean(),
}),
reviews: z.array(z.unknown()),
});
15 changes: 0 additions & 15 deletions src/infrastructure/factorial-client/schema/Shift.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,21 +4,6 @@ export const Shift = z.object({
id: z.number(),
periodId: z.number(),
day: z.number(),
clockIn: z.string(),
clockOut: z.string(),
minutes: z.number(),
history: z.array(z.unknown()),
observations: z.null(),
date: z.string(),
halfDay: z.null(),
workable: z.boolean(),
automaticClockIn: z.boolean(),
automaticClockOut: z.boolean(),
clockInWithSeconds: z.string(),
employeeId: z.number(),
permissions: z.object({ history: z.boolean() }),
locationType: z.null(),
timeSettingsBreakConfigurationId: z.null(),
});

export type Shift = z.infer<typeof Shift>;

0 comments on commit aa7fabb

Please sign in to comment.