From a5bd7d54fe8223bce62f8e4eea5e8b6fa16026ae Mon Sep 17 00:00:00 2001 From: Matthieu Haineault Date: Mon, 23 Mar 2026 14:21:36 -0400 Subject: [PATCH] fix(contracts): added a contract class to employee and timesheet overview dtos and ajusted queries --- .gitignore | 4 - .../prisma/client/postgres/internal/class.ts | 2 +- .../client/postgres/models/Contracts.ts | 1442 +++++++++++++++++ .../client/postgres/models/Notifications.ts | 1439 ++++++++++++++++ prisma/postgres/schema.prisma | 6 +- .../contract/contract.controller.ts | 1 + .../contract/contract.dto.ts | 1 - .../employees/employee-detailed.dto.ts | 30 +- .../services/employees-create.service.ts | 9 +- .../services/employees-get.service.ts | 120 +- .../services/employees-update.service.ts | 9 +- .../timesheet-employee-overview.service.ts | 39 +- .../timesheets/timesheet.dto.ts | 13 +- 13 files changed, 3036 insertions(+), 79 deletions(-) create mode 100644 prisma/postgres/generated/prisma/client/postgres/models/Contracts.ts create mode 100644 prisma/postgres/generated/prisma/client/postgres/models/Notifications.ts diff --git a/.gitignore b/.gitignore index c7b7bb2..8eb1186 100644 --- a/.gitignore +++ b/.gitignore @@ -55,9 +55,5 @@ pids # Diagnostic reports (https://nodejs.org/api/report.html) report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json -# Generated prisma folders (from -> npm run prisma:generated) -prisma/mariadb/generated/prisma/client/mariadb/ -prisma/postgres/generated/prisma/client/postgres/ -prisma/prisma-legacy/generated/prisma/client/legacy/ !swagger-spec.json diff --git a/prisma/postgres/generated/prisma/client/postgres/internal/class.ts b/prisma/postgres/generated/prisma/client/postgres/internal/class.ts index 4b0a484..fe993ce 100644 --- a/prisma/postgres/generated/prisma/client/postgres/internal/class.ts +++ b/prisma/postgres/generated/prisma/client/postgres/internal/class.ts @@ -22,7 +22,7 @@ const config: runtime.GetPrismaClientConfig = { "clientVersion": "7.3.0", "engineVersion": "9d6ad21cbbceab97458517b147a6a09ff43aa735", "activeProvider": "postgresql", - "inlineSchema": "generator client {\n provider = \"prisma-client\"\n output = \"generated/prisma/client/postgres\"\n previewFeatures = [\"views\"]\n}\n\ndatasource db {\n provider = \"postgresql\"\n}\n\nmodel Users {\n id String @id @default(dbgenerated(\"gen_random_uuid()\")) @db.Uuid\n first_name String\n last_name String\n email String @unique\n phone_number String\n residence String?\n role Roles @default(EMPLOYEE)\n\n notifications Notifications? @relation(\"UserNotification\")\n employee Employees? @relation(\"UserEmployee\")\n oauth_sessions OAuthSessions[] @relation(\"UserOAuthSessions\")\n preferences Preferences? @relation(\"UserPreferences\")\n user_module_access userModuleAccess? @relation(\"UserModuleAccess\")\n\n @@map(\"users\")\n}\n\nmodel Notifications {\n id Int @id @default(autoincrement())\n user_id String @unique @db.Uuid\n affected_module Modules\n subject String\n description String\n metadata Json @db.JsonB\n created_at DateTime @default(now())\n viewed_at DateTime?\n\n user Users @relation(\"UserNotification\", fields: [user_id], references: [id])\n\n @@map(\"notifications\")\n}\n\nmodel userModuleAccess {\n id Int @id @default(autoincrement())\n user_id String @unique @db.Uuid\n timesheets Boolean @default(true)\n timesheets_approval Boolean @default(false)\n employee_list Boolean @default(true)\n employee_management Boolean @default(false)\n personal_profile Boolean @default(true)\n dashboard Boolean @default(true)\n chatbot Boolean @default(false)\n ticket Boolean @default(false)\n ticket_management Boolean @default(false)\n\n user Users @relation(\"UserModuleAccess\", fields: [user_id], references: [id])\n\n @@map(\"user_module_access\")\n}\n\nmodel Employees {\n id Int @id @default(autoincrement())\n user_id String @unique @db.Uuid\n external_payroll_id Int\n company_code Int\n first_work_day DateTime @db.Date\n last_work_day DateTime? @db.Date\n supervisor_id Int?\n job_title String?\n is_supervisor Boolean @default(false)\n schedule_preset_id Int?\n\n schedule_preset SchedulePresets? @relation(\"EmployeesSchedulePreset\", fields: [schedule_preset_id], references: [id])\n supervisor Employees? @relation(\"EmployeeSupervisor\", fields: [supervisor_id], references: [id])\n crew Employees[] @relation(\"EmployeeSupervisor\")\n user Users @relation(\"UserEmployee\", fields: [user_id], references: [id])\n leave_request LeaveRequests[] @relation(\"LeaveRequestEmployee\")\n timesheet Timesheets[] @relation(\"TimesheetEmployee\")\n paid_time_off PaidTimeOff? @relation(\"EmployeePaidTimeOff\")\n contracts Contracts? @relation(\"EmployeeContract\")\n\n @@map(\"employees\")\n}\n\nmodel Contracts {\n id Int @id @default(autoincrement())\n employee_id Int @unique\n daily_expected_hours Int @default(24)\n applicable_overtime ApplicableOvertime[] @default([WEEKLY])\n phone_allocation Decimal @default(0.00)\n on_call_allocation Decimal @default(0.00)\n weekend_on_call_allocation Decimal @default(0.00)\n\n employee Employees @relation(\"EmployeeContract\", fields: [employee_id], references: [id])\n\n @@map(\"contracts\")\n}\n\nmodel LeaveRequests {\n id Int @id @default(autoincrement())\n employee_id Int\n leave_type LeaveTypes\n comment String\n approval_status LeaveApprovalStatus @default(PENDING)\n bank_code_id Int\n payable_hours Decimal? @db.Decimal(5, 2)\n requested_hours Decimal? @db.Decimal(5, 2)\n dates DateTime[] @db.Date\n\n bank_code BankCodes @relation(\"LeaveRequestBankCodes\", fields: [bank_code_id], references: [id])\n employee Employees @relation(\"LeaveRequestEmployee\", fields: [employee_id], references: [id])\n archive LeaveRequestsArchive? @relation(\"LeaveRequestToArchive\")\n\n @@unique([employee_id, leave_type, dates], name: \"leave_per_employee_date\")\n @@index([employee_id, dates])\n @@map(\"leave_requests\")\n}\n\nmodel LeaveRequestsArchive {\n id Int @id @default(autoincrement())\n leave_request_id Int @unique\n archived_at DateTime @default(now())\n employee_id Int\n leave_type LeaveTypes\n comment String\n approval_status LeaveApprovalStatus\n date DateTime @db.Date\n payable_hours Decimal? @db.Decimal(5, 2)\n requested_hours Decimal? @db.Decimal(5, 2)\n\n leave_request LeaveRequests @relation(\"LeaveRequestToArchive\", fields: [leave_request_id], references: [id])\n\n @@index([employee_id, date])\n @@map(\"leave_requests_archive\")\n}\n\nmodel Timesheets {\n id Int @id @default(autoincrement())\n employee_id Int\n is_approved Boolean @default(false)\n start_date DateTime @db.Date\n // hours_to_bank Decimal? @db.Decimal(5, 2) //will need to be implemented in the future\n\n expense Expenses[] @relation(\"ExpensesTimesheet\")\n shift Shifts[] @relation(\"ShiftTimesheet\")\n employee Employees @relation(\"TimesheetEmployee\", fields: [employee_id], references: [id])\n archive TimesheetsArchive[] @relation(\"TimesheetsToArchive\")\n\n // @@unique([employee_id, start_date], name: \"employee_id_start_date\")\n @@map(\"timesheets\")\n}\n\nmodel TimesheetsArchive {\n id Int @id @default(autoincrement())\n timesheet_id Int\n archive_at DateTime @default(now())\n employee_id Int\n is_approved Boolean\n timesheet Timesheets @relation(\"TimesheetsToArchive\", fields: [timesheet_id], references: [id])\n\n @@map(\"timesheets_archive\")\n}\n\nmodel SchedulePresets {\n id Int @id @default(autoincrement())\n name String\n is_default Boolean @default(false)\n employees Employees[] @relation(\"EmployeesSchedulePreset\")\n shifts SchedulePresetShifts[] @relation(\"SchedulePresetShiftsSchedulePreset\")\n\n @@map(\"schedule_presets\")\n}\n\nmodel SchedulePresetShifts {\n id Int @id @default(autoincrement())\n preset_id Int\n bank_code_id Int\n\n start_time DateTime @db.Time(0)\n end_time DateTime @db.Time(0)\n is_remote Boolean @default(false)\n week_day Weekday\n bank_code BankCodes @relation(\"SchedulePresetShiftsBankCodes\", fields: [bank_code_id], references: [id])\n preset SchedulePresets @relation(\"SchedulePresetShiftsSchedulePreset\", fields: [preset_id], references: [id])\n\n @@index([preset_id, week_day])\n @@map(\"schedule_preset_shifts\")\n}\n\nmodel Shifts {\n id Int @id @default(autoincrement())\n timesheet_id Int\n date DateTime @db.Date\n start_time DateTime @db.Time(0)\n end_time DateTime @db.Time(0)\n bank_code_id Int\n is_approved Boolean @default(false)\n is_remote Boolean @default(false)\n comment String?\n bank_code BankCodes @relation(\"ShiftBankCodes\", fields: [bank_code_id], references: [id])\n timesheet Timesheets @relation(\"ShiftTimesheet\", fields: [timesheet_id], references: [id])\n archive ShiftsArchive[] @relation(\"ShiftsToArchive\")\n\n // @@unique([timesheet_id, date, start_time], name: \"unique_ts_id_date_start_time\")\n @@map(\"shifts\")\n}\n\nmodel ShiftsArchive {\n id Int @id @default(autoincrement())\n shift_id Int\n archive_at DateTime @default(now())\n timesheet_id Int\n date DateTime @db.Date\n start_time DateTime @db.Time(0)\n end_time DateTime @db.Time(0)\n bank_code_id Int\n comment String?\n shift Shifts @relation(\"ShiftsToArchive\", fields: [shift_id], references: [id])\n\n @@map(\"shifts_archive\")\n}\n\nmodel BankCodes {\n id Int @id @default(autoincrement())\n type String\n categorie String\n modifier Float\n bank_code String\n expenses Expenses[] @relation(\"ExpenseBankCodes\")\n leaveRequests LeaveRequests[] @relation(\"LeaveRequestBankCodes\")\n SchedulePresetShifts SchedulePresetShifts[] @relation(\"SchedulePresetShiftsBankCodes\")\n shifts Shifts[] @relation(\"ShiftBankCodes\")\n\n @@map(\"bank_codes\")\n}\n\nmodel Expenses {\n id Int @id @default(autoincrement())\n timesheet_id Int\n date DateTime @db.Date\n amount Decimal? @db.Decimal(12, 2)\n is_approved Boolean @default(false)\n supervisor_comment String?\n bank_code_id Int\n comment String\n attachment_key String?\n attachment_name String?\n mileage Decimal? @db.Decimal(12, 2)\n bank_code BankCodes @relation(\"ExpenseBankCodes\", fields: [bank_code_id], references: [id])\n timesheet Timesheets @relation(\"ExpensesTimesheet\", fields: [timesheet_id], references: [id])\n archive ExpensesArchive[] @relation(\"ExpensesToArchive\")\n\n @@unique([timesheet_id, date, amount, mileage], name: \"unique_ts_id_date_amount_mileage\")\n @@map(\"expenses\")\n}\n\nmodel ExpensesArchive {\n id Int @id @default(autoincrement())\n expense_id Int\n timesheet_id Int\n archived_at DateTime @default(now())\n date DateTime @db.Date\n amount Decimal? @db.Decimal(12, 2)\n is_approved Boolean\n supervisor_comment String?\n bank_code_id Int\n comment String?\n mileage Decimal? @db.Decimal(12, 2)\n expense Expenses @relation(\"ExpensesToArchive\", fields: [expense_id], references: [id])\n\n @@map(\"expenses_archive\")\n}\n\nmodel OAuthSessions {\n id String @id @default(cuid())\n user_id String @db.Uuid\n application String\n access_token String @unique\n refresh_token String @unique\n access_token_expiry DateTime\n refresh_token_expiry DateTime?\n is_revoked Boolean @default(false)\n scopes Json @default(\"[]\")\n created_at DateTime @default(now())\n updated_at DateTime?\n sid String @unique\n user Users @relation(\"UserOAuthSessions\", fields: [user_id], references: [id])\n\n @@map(\"oauth_sessions\")\n}\n\nmodel Sessions {\n id String @id\n sid String @unique\n data String\n expiresAt DateTime\n\n @@map(\"sessions\")\n}\n\nmodel Preferences {\n user_id String @unique @db.Uuid\n id Int @id @default(autoincrement())\n display_language String @default(\"fr-FR\")\n is_dark_mode Boolean? @default(false)\n is_employee_list_grid Boolean @default(true)\n is_lefty_mode Boolean @default(false)\n is_timesheet_approval_grid Boolean @default(true)\n notifications Boolean @default(true)\n user Users @relation(\"UserPreferences\", fields: [user_id], references: [id])\n\n @@map(\"preferences\")\n}\n\nmodel PaidTimeOff {\n id Int @id @default(autoincrement())\n employee_id Int @unique\n vacation_hours Decimal @default(0) @db.Decimal(12, 2)\n banked_hours Decimal @default(0) @db.Decimal(12, 2)\n sick_hours Decimal @default(0) @db.Decimal(12, 2)\n last_updated DateTime? @db.Date\n\n employee Employees @relation(\"EmployeePaidTimeOff\", fields: [employee_id], references: [id])\n\n @@map(\"paid_time_off\")\n}\n\nview PayPeriods {\n pay_year Int\n pay_period_no Int\n period_start DateTime @db.Date\n period_end DateTime @db.Date\n payday DateTime @db.Date\n label String\n\n @@map(\"pay_period\")\n}\n\nenum AttachmentStatus {\n ACTIVE\n DELETED\n}\n\nenum RetentionPolicy {\n EXPENSE_7Y\n TICKET_2Y\n PROFILE_KEEP_LAST3\n}\n\nenum Roles {\n ADMIN\n SUPERVISOR\n HR\n ACCOUNTING\n EMPLOYEE\n DEALER\n CUSTOMER\n GUEST\n\n @@map(\"roles\")\n}\n\nenum Modules {\n timesheets\n timesheets_approval\n employee_list\n employee_management\n personal_profile\n dashboard\n ticket\n ticket_management\n chatbot\n\n @@map(\"modules\")\n}\n\nenum LeaveTypes {\n SICK\n VACATION\n UNPAID\n BEREAVEMENT\n PARENTAL\n LEGAL\n WEDDING\n HOLIDAY\n\n @@map(\"leave_types\")\n}\n\nenum LeaveApprovalStatus {\n PENDING\n APPROVED\n DENIED\n CANCELLED\n ESCALATED\n\n @@map(\"leave_approval_status\")\n}\n\nenum Weekday {\n SUN\n MON\n TUE\n WED\n THU\n FRI\n SAT\n}\n\nenum ApplicableOvertime {\n DAILY\n WEEKLY\n PAYPERIOD\n}\n", + "inlineSchema": "generator client {\n provider = \"prisma-client\"\n output = \"generated/prisma/client/postgres\"\n previewFeatures = [\"views\"]\n}\n\ndatasource db {\n provider = \"postgresql\"\n}\n\nmodel Users {\n id String @id @default(dbgenerated(\"gen_random_uuid()\")) @db.Uuid\n first_name String\n last_name String\n email String @unique\n phone_number String\n residence String?\n role Roles @default(EMPLOYEE)\n\n notifications Notifications? @relation(\"UserNotification\")\n employee Employees? @relation(\"UserEmployee\")\n oauth_sessions OAuthSessions[] @relation(\"UserOAuthSessions\")\n preferences Preferences? @relation(\"UserPreferences\")\n user_module_access userModuleAccess? @relation(\"UserModuleAccess\")\n\n @@map(\"users\")\n}\n\nmodel Notifications {\n id Int @id @default(autoincrement())\n user_id String @unique @db.Uuid\n affected_module Modules\n subject String\n description String\n metadata Json @db.JsonB\n created_at DateTime @default(now())\n viewed_at DateTime?\n\n user Users @relation(\"UserNotification\", fields: [user_id], references: [id])\n\n @@map(\"notifications\")\n}\n\nmodel userModuleAccess {\n id Int @id @default(autoincrement())\n user_id String @unique @db.Uuid\n timesheets Boolean @default(true)\n timesheets_approval Boolean @default(false)\n employee_list Boolean @default(true)\n employee_management Boolean @default(false)\n personal_profile Boolean @default(true)\n dashboard Boolean @default(true)\n chatbot Boolean @default(false)\n ticket Boolean @default(false)\n ticket_management Boolean @default(false)\n\n user Users @relation(\"UserModuleAccess\", fields: [user_id], references: [id])\n\n @@map(\"user_module_access\")\n}\n\nmodel Employees {\n id Int @id @default(autoincrement())\n user_id String @unique @db.Uuid\n external_payroll_id Int\n company_code Int\n first_work_day DateTime @db.Date\n last_work_day DateTime? @db.Date\n supervisor_id Int?\n job_title String?\n is_supervisor Boolean @default(false)\n schedule_preset_id Int?\n\n schedule_preset SchedulePresets? @relation(\"EmployeesSchedulePreset\", fields: [schedule_preset_id], references: [id])\n supervisor Employees? @relation(\"EmployeeSupervisor\", fields: [supervisor_id], references: [id])\n crew Employees[] @relation(\"EmployeeSupervisor\")\n user Users @relation(\"UserEmployee\", fields: [user_id], references: [id])\n leave_request LeaveRequests[] @relation(\"LeaveRequestEmployee\")\n timesheet Timesheets[] @relation(\"TimesheetEmployee\")\n paid_time_off PaidTimeOff? @relation(\"EmployeePaidTimeOff\")\n contracts Contracts? @relation(\"EmployeeContract\")\n\n @@map(\"employees\")\n}\n\nmodel Contracts {\n id Int @id @default(autoincrement())\n employee_id Int @unique\n daily_expected_hours Int @default(24)\n applicable_overtime ApplicableOvertime[] @default([WEEKLY])\n phone_allocation Decimal @default(0.00) @db.Decimal(5, 2)\n on_call_allocation Decimal @default(0.00) @db.Decimal(5, 2)\n weekend_on_call_allocation Decimal @default(0.00) @db.Decimal(5, 2)\n\n employee Employees @relation(\"EmployeeContract\", fields: [employee_id], references: [id])\n\n @@map(\"contracts\")\n}\n\nmodel LeaveRequests {\n id Int @id @default(autoincrement())\n employee_id Int\n leave_type LeaveTypes\n comment String\n approval_status LeaveApprovalStatus @default(PENDING)\n bank_code_id Int\n payable_hours Decimal? @db.Decimal(5, 2)\n requested_hours Decimal? @db.Decimal(5, 2)\n dates DateTime[] @db.Date\n\n bank_code BankCodes @relation(\"LeaveRequestBankCodes\", fields: [bank_code_id], references: [id])\n employee Employees @relation(\"LeaveRequestEmployee\", fields: [employee_id], references: [id])\n archive LeaveRequestsArchive? @relation(\"LeaveRequestToArchive\")\n\n @@unique([employee_id, leave_type, dates], name: \"leave_per_employee_date\")\n @@index([employee_id, dates])\n @@map(\"leave_requests\")\n}\n\nmodel LeaveRequestsArchive {\n id Int @id @default(autoincrement())\n leave_request_id Int @unique\n archived_at DateTime @default(now())\n employee_id Int\n leave_type LeaveTypes\n comment String\n approval_status LeaveApprovalStatus\n date DateTime @db.Date\n payable_hours Decimal? @db.Decimal(5, 2)\n requested_hours Decimal? @db.Decimal(5, 2)\n\n leave_request LeaveRequests @relation(\"LeaveRequestToArchive\", fields: [leave_request_id], references: [id])\n\n @@index([employee_id, date])\n @@map(\"leave_requests_archive\")\n}\n\nmodel Timesheets {\n id Int @id @default(autoincrement())\n employee_id Int\n is_approved Boolean @default(false)\n start_date DateTime @db.Date\n // hours_to_bank Decimal? @db.Decimal(5, 2) //will need to be implemented in the future\n\n expense Expenses[] @relation(\"ExpensesTimesheet\")\n shift Shifts[] @relation(\"ShiftTimesheet\")\n employee Employees @relation(\"TimesheetEmployee\", fields: [employee_id], references: [id])\n archive TimesheetsArchive[] @relation(\"TimesheetsToArchive\")\n\n // @@unique([employee_id, start_date], name: \"employee_id_start_date\")\n @@map(\"timesheets\")\n}\n\nmodel TimesheetsArchive {\n id Int @id @default(autoincrement())\n timesheet_id Int\n archive_at DateTime @default(now())\n employee_id Int\n is_approved Boolean\n timesheet Timesheets @relation(\"TimesheetsToArchive\", fields: [timesheet_id], references: [id])\n\n @@map(\"timesheets_archive\")\n}\n\nmodel SchedulePresets {\n id Int @id @default(autoincrement())\n name String\n is_default Boolean @default(false)\n employees Employees[] @relation(\"EmployeesSchedulePreset\")\n shifts SchedulePresetShifts[] @relation(\"SchedulePresetShiftsSchedulePreset\")\n\n @@map(\"schedule_presets\")\n}\n\nmodel SchedulePresetShifts {\n id Int @id @default(autoincrement())\n preset_id Int\n bank_code_id Int\n\n start_time DateTime @db.Time(0)\n end_time DateTime @db.Time(0)\n is_remote Boolean @default(false)\n week_day Weekday\n bank_code BankCodes @relation(\"SchedulePresetShiftsBankCodes\", fields: [bank_code_id], references: [id])\n preset SchedulePresets @relation(\"SchedulePresetShiftsSchedulePreset\", fields: [preset_id], references: [id])\n\n @@index([preset_id, week_day])\n @@map(\"schedule_preset_shifts\")\n}\n\nmodel Shifts {\n id Int @id @default(autoincrement())\n timesheet_id Int\n date DateTime @db.Date\n start_time DateTime @db.Time(0)\n end_time DateTime @db.Time(0)\n bank_code_id Int\n is_approved Boolean @default(false)\n is_remote Boolean @default(false)\n comment String?\n bank_code BankCodes @relation(\"ShiftBankCodes\", fields: [bank_code_id], references: [id])\n timesheet Timesheets @relation(\"ShiftTimesheet\", fields: [timesheet_id], references: [id])\n archive ShiftsArchive[] @relation(\"ShiftsToArchive\")\n\n // @@unique([timesheet_id, date, start_time], name: \"unique_ts_id_date_start_time\")\n @@map(\"shifts\")\n}\n\nmodel ShiftsArchive {\n id Int @id @default(autoincrement())\n shift_id Int\n archive_at DateTime @default(now())\n timesheet_id Int\n date DateTime @db.Date\n start_time DateTime @db.Time(0)\n end_time DateTime @db.Time(0)\n bank_code_id Int\n comment String?\n shift Shifts @relation(\"ShiftsToArchive\", fields: [shift_id], references: [id])\n\n @@map(\"shifts_archive\")\n}\n\nmodel BankCodes {\n id Int @id @default(autoincrement())\n type String\n categorie String\n modifier Float\n bank_code String\n expenses Expenses[] @relation(\"ExpenseBankCodes\")\n leaveRequests LeaveRequests[] @relation(\"LeaveRequestBankCodes\")\n SchedulePresetShifts SchedulePresetShifts[] @relation(\"SchedulePresetShiftsBankCodes\")\n shifts Shifts[] @relation(\"ShiftBankCodes\")\n\n @@map(\"bank_codes\")\n}\n\nmodel Expenses {\n id Int @id @default(autoincrement())\n timesheet_id Int\n date DateTime @db.Date\n amount Decimal? @db.Decimal(12, 2)\n is_approved Boolean @default(false)\n supervisor_comment String?\n bank_code_id Int\n comment String\n attachment_key String?\n attachment_name String?\n mileage Decimal? @db.Decimal(12, 2)\n bank_code BankCodes @relation(\"ExpenseBankCodes\", fields: [bank_code_id], references: [id])\n timesheet Timesheets @relation(\"ExpensesTimesheet\", fields: [timesheet_id], references: [id])\n archive ExpensesArchive[] @relation(\"ExpensesToArchive\")\n\n @@unique([timesheet_id, date, amount, mileage], name: \"unique_ts_id_date_amount_mileage\")\n @@map(\"expenses\")\n}\n\nmodel ExpensesArchive {\n id Int @id @default(autoincrement())\n expense_id Int\n timesheet_id Int\n archived_at DateTime @default(now())\n date DateTime @db.Date\n amount Decimal? @db.Decimal(12, 2)\n is_approved Boolean\n supervisor_comment String?\n bank_code_id Int\n comment String?\n mileage Decimal? @db.Decimal(12, 2)\n expense Expenses @relation(\"ExpensesToArchive\", fields: [expense_id], references: [id])\n\n @@map(\"expenses_archive\")\n}\n\nmodel OAuthSessions {\n id String @id @default(cuid())\n user_id String @db.Uuid\n application String\n access_token String @unique\n refresh_token String @unique\n access_token_expiry DateTime\n refresh_token_expiry DateTime?\n is_revoked Boolean @default(false)\n scopes Json @default(\"[]\")\n created_at DateTime @default(now())\n updated_at DateTime?\n sid String @unique\n user Users @relation(\"UserOAuthSessions\", fields: [user_id], references: [id])\n\n @@map(\"oauth_sessions\")\n}\n\nmodel Sessions {\n id String @id\n sid String @unique\n data String\n expiresAt DateTime\n\n @@map(\"sessions\")\n}\n\nmodel Preferences {\n user_id String @unique @db.Uuid\n id Int @id @default(autoincrement())\n display_language String @default(\"fr-FR\")\n is_dark_mode Boolean? @default(false)\n is_employee_list_grid Boolean @default(true)\n is_lefty_mode Boolean @default(false)\n is_timesheet_approval_grid Boolean @default(true)\n notifications Boolean @default(true)\n user Users @relation(\"UserPreferences\", fields: [user_id], references: [id])\n\n @@map(\"preferences\")\n}\n\nmodel PaidTimeOff {\n id Int @id @default(autoincrement())\n employee_id Int @unique\n vacation_hours Decimal @default(0) @db.Decimal(12, 2)\n banked_hours Decimal @default(0) @db.Decimal(12, 2)\n sick_hours Decimal @default(0) @db.Decimal(12, 2)\n last_updated DateTime? @db.Date\n\n employee Employees @relation(\"EmployeePaidTimeOff\", fields: [employee_id], references: [id])\n\n @@map(\"paid_time_off\")\n}\n\nview PayPeriods {\n pay_year Int\n pay_period_no Int\n period_start DateTime @db.Date\n period_end DateTime @db.Date\n payday DateTime @db.Date\n label String\n\n @@map(\"pay_period\")\n}\n\nenum AttachmentStatus {\n ACTIVE\n DELETED\n}\n\nenum RetentionPolicy {\n EXPENSE_7Y\n TICKET_2Y\n PROFILE_KEEP_LAST3\n}\n\nenum Roles {\n ADMIN\n SUPERVISOR\n HR\n ACCOUNTING\n EMPLOYEE\n DEALER\n CUSTOMER\n GUEST\n\n @@map(\"roles\")\n}\n\nenum Modules {\n timesheets\n timesheets_approval\n employee_list\n employee_management\n personal_profile\n dashboard\n ticket\n ticket_management\n chatbot\n\n @@map(\"modules\")\n}\n\nenum LeaveTypes {\n SICK\n VACATION\n UNPAID\n BEREAVEMENT\n PARENTAL\n LEGAL\n WEDDING\n HOLIDAY\n\n @@map(\"leave_types\")\n}\n\nenum LeaveApprovalStatus {\n PENDING\n APPROVED\n DENIED\n CANCELLED\n ESCALATED\n\n @@map(\"leave_approval_status\")\n}\n\nenum Weekday {\n SUN\n MON\n TUE\n WED\n THU\n FRI\n SAT\n}\n\nenum ApplicableOvertime {\n DAILY\n WEEKLY\n PAYPERIOD\n}\n", "runtimeDataModel": { "models": {}, "enums": {}, diff --git a/prisma/postgres/generated/prisma/client/postgres/models/Contracts.ts b/prisma/postgres/generated/prisma/client/postgres/models/Contracts.ts new file mode 100644 index 0000000..f923a85 --- /dev/null +++ b/prisma/postgres/generated/prisma/client/postgres/models/Contracts.ts @@ -0,0 +1,1442 @@ + +/* !!! This is code generated by Prisma. Do not edit directly. !!! */ +/* eslint-disable */ +// biome-ignore-all lint: generated file +// @ts-nocheck +/* + * This file exports the `Contracts` model and its related types. + * + * 🟢 You can import this file directly. + */ +import type * as runtime from "@prisma/client/runtime/client" +import type * as $Enums from "../enums" +import type * as Prisma from "../internal/prismaNamespace" + +/** + * Model Contracts + * + */ +export type ContractsModel = runtime.Types.Result.DefaultSelection + +export type AggregateContracts = { + _count: ContractsCountAggregateOutputType | null + _avg: ContractsAvgAggregateOutputType | null + _sum: ContractsSumAggregateOutputType | null + _min: ContractsMinAggregateOutputType | null + _max: ContractsMaxAggregateOutputType | null +} + +export type ContractsAvgAggregateOutputType = { + id: number | null + employee_id: number | null + daily_expected_hours: number | null + phone_allocation: runtime.Decimal | null + on_call_allocation: runtime.Decimal | null + weekend_on_call_allocation: runtime.Decimal | null +} + +export type ContractsSumAggregateOutputType = { + id: number | null + employee_id: number | null + daily_expected_hours: number | null + phone_allocation: runtime.Decimal | null + on_call_allocation: runtime.Decimal | null + weekend_on_call_allocation: runtime.Decimal | null +} + +export type ContractsMinAggregateOutputType = { + id: number | null + employee_id: number | null + daily_expected_hours: number | null + phone_allocation: runtime.Decimal | null + on_call_allocation: runtime.Decimal | null + weekend_on_call_allocation: runtime.Decimal | null +} + +export type ContractsMaxAggregateOutputType = { + id: number | null + employee_id: number | null + daily_expected_hours: number | null + phone_allocation: runtime.Decimal | null + on_call_allocation: runtime.Decimal | null + weekend_on_call_allocation: runtime.Decimal | null +} + +export type ContractsCountAggregateOutputType = { + id: number + employee_id: number + daily_expected_hours: number + applicable_overtime: number + phone_allocation: number + on_call_allocation: number + weekend_on_call_allocation: number + _all: number +} + + +export type ContractsAvgAggregateInputType = { + id?: true + employee_id?: true + daily_expected_hours?: true + phone_allocation?: true + on_call_allocation?: true + weekend_on_call_allocation?: true +} + +export type ContractsSumAggregateInputType = { + id?: true + employee_id?: true + daily_expected_hours?: true + phone_allocation?: true + on_call_allocation?: true + weekend_on_call_allocation?: true +} + +export type ContractsMinAggregateInputType = { + id?: true + employee_id?: true + daily_expected_hours?: true + phone_allocation?: true + on_call_allocation?: true + weekend_on_call_allocation?: true +} + +export type ContractsMaxAggregateInputType = { + id?: true + employee_id?: true + daily_expected_hours?: true + phone_allocation?: true + on_call_allocation?: true + weekend_on_call_allocation?: true +} + +export type ContractsCountAggregateInputType = { + id?: true + employee_id?: true + daily_expected_hours?: true + applicable_overtime?: true + phone_allocation?: true + on_call_allocation?: true + weekend_on_call_allocation?: true + _all?: true +} + +export type ContractsAggregateArgs = { + /** + * Filter which Contracts to aggregate. + */ + where?: Prisma.ContractsWhereInput + /** + * {@link https://www.prisma.io/docs/concepts/components/prisma-client/sorting Sorting Docs} + * + * Determine the order of Contracts to fetch. + */ + orderBy?: Prisma.ContractsOrderByWithRelationInput | Prisma.ContractsOrderByWithRelationInput[] + /** + * {@link https://www.prisma.io/docs/concepts/components/prisma-client/pagination#cursor-based-pagination Cursor Docs} + * + * Sets the start position + */ + cursor?: Prisma.ContractsWhereUniqueInput + /** + * {@link https://www.prisma.io/docs/concepts/components/prisma-client/pagination Pagination Docs} + * + * Take `±n` Contracts from the position of the cursor. + */ + take?: number + /** + * {@link https://www.prisma.io/docs/concepts/components/prisma-client/pagination Pagination Docs} + * + * Skip the first `n` Contracts. + */ + skip?: number + /** + * {@link https://www.prisma.io/docs/concepts/components/prisma-client/aggregations Aggregation Docs} + * + * Count returned Contracts + **/ + _count?: true | ContractsCountAggregateInputType + /** + * {@link https://www.prisma.io/docs/concepts/components/prisma-client/aggregations Aggregation Docs} + * + * Select which fields to average + **/ + _avg?: ContractsAvgAggregateInputType + /** + * {@link https://www.prisma.io/docs/concepts/components/prisma-client/aggregations Aggregation Docs} + * + * Select which fields to sum + **/ + _sum?: ContractsSumAggregateInputType + /** + * {@link https://www.prisma.io/docs/concepts/components/prisma-client/aggregations Aggregation Docs} + * + * Select which fields to find the minimum value + **/ + _min?: ContractsMinAggregateInputType + /** + * {@link https://www.prisma.io/docs/concepts/components/prisma-client/aggregations Aggregation Docs} + * + * Select which fields to find the maximum value + **/ + _max?: ContractsMaxAggregateInputType +} + +export type GetContractsAggregateType = { + [P in keyof T & keyof AggregateContracts]: P extends '_count' | 'count' + ? T[P] extends true + ? number + : Prisma.GetScalarType + : Prisma.GetScalarType +} + + + + +export type ContractsGroupByArgs = { + where?: Prisma.ContractsWhereInput + orderBy?: Prisma.ContractsOrderByWithAggregationInput | Prisma.ContractsOrderByWithAggregationInput[] + by: Prisma.ContractsScalarFieldEnum[] | Prisma.ContractsScalarFieldEnum + having?: Prisma.ContractsScalarWhereWithAggregatesInput + take?: number + skip?: number + _count?: ContractsCountAggregateInputType | true + _avg?: ContractsAvgAggregateInputType + _sum?: ContractsSumAggregateInputType + _min?: ContractsMinAggregateInputType + _max?: ContractsMaxAggregateInputType +} + +export type ContractsGroupByOutputType = { + id: number + employee_id: number + daily_expected_hours: number + applicable_overtime: $Enums.ApplicableOvertime[] + phone_allocation: runtime.Decimal + on_call_allocation: runtime.Decimal + weekend_on_call_allocation: runtime.Decimal + _count: ContractsCountAggregateOutputType | null + _avg: ContractsAvgAggregateOutputType | null + _sum: ContractsSumAggregateOutputType | null + _min: ContractsMinAggregateOutputType | null + _max: ContractsMaxAggregateOutputType | null +} + +type GetContractsGroupByPayload = Prisma.PrismaPromise< + Array< + Prisma.PickEnumerable & + { + [P in ((keyof T) & (keyof ContractsGroupByOutputType))]: P extends '_count' + ? T[P] extends boolean + ? number + : Prisma.GetScalarType + : Prisma.GetScalarType + } + > + > + + + +export type ContractsWhereInput = { + AND?: Prisma.ContractsWhereInput | Prisma.ContractsWhereInput[] + OR?: Prisma.ContractsWhereInput[] + NOT?: Prisma.ContractsWhereInput | Prisma.ContractsWhereInput[] + id?: Prisma.IntFilter<"Contracts"> | number + employee_id?: Prisma.IntFilter<"Contracts"> | number + daily_expected_hours?: Prisma.IntFilter<"Contracts"> | number + applicable_overtime?: Prisma.EnumApplicableOvertimeNullableListFilter<"Contracts"> + phone_allocation?: Prisma.DecimalFilter<"Contracts"> | runtime.Decimal | runtime.DecimalJsLike | number | string + on_call_allocation?: Prisma.DecimalFilter<"Contracts"> | runtime.Decimal | runtime.DecimalJsLike | number | string + weekend_on_call_allocation?: Prisma.DecimalFilter<"Contracts"> | runtime.Decimal | runtime.DecimalJsLike | number | string + employee?: Prisma.XOR +} + +export type ContractsOrderByWithRelationInput = { + id?: Prisma.SortOrder + employee_id?: Prisma.SortOrder + daily_expected_hours?: Prisma.SortOrder + applicable_overtime?: Prisma.SortOrder + phone_allocation?: Prisma.SortOrder + on_call_allocation?: Prisma.SortOrder + weekend_on_call_allocation?: Prisma.SortOrder + employee?: Prisma.EmployeesOrderByWithRelationInput +} + +export type ContractsWhereUniqueInput = Prisma.AtLeast<{ + id?: number + employee_id?: number + AND?: Prisma.ContractsWhereInput | Prisma.ContractsWhereInput[] + OR?: Prisma.ContractsWhereInput[] + NOT?: Prisma.ContractsWhereInput | Prisma.ContractsWhereInput[] + daily_expected_hours?: Prisma.IntFilter<"Contracts"> | number + applicable_overtime?: Prisma.EnumApplicableOvertimeNullableListFilter<"Contracts"> + phone_allocation?: Prisma.DecimalFilter<"Contracts"> | runtime.Decimal | runtime.DecimalJsLike | number | string + on_call_allocation?: Prisma.DecimalFilter<"Contracts"> | runtime.Decimal | runtime.DecimalJsLike | number | string + weekend_on_call_allocation?: Prisma.DecimalFilter<"Contracts"> | runtime.Decimal | runtime.DecimalJsLike | number | string + employee?: Prisma.XOR +}, "id" | "employee_id"> + +export type ContractsOrderByWithAggregationInput = { + id?: Prisma.SortOrder + employee_id?: Prisma.SortOrder + daily_expected_hours?: Prisma.SortOrder + applicable_overtime?: Prisma.SortOrder + phone_allocation?: Prisma.SortOrder + on_call_allocation?: Prisma.SortOrder + weekend_on_call_allocation?: Prisma.SortOrder + _count?: Prisma.ContractsCountOrderByAggregateInput + _avg?: Prisma.ContractsAvgOrderByAggregateInput + _max?: Prisma.ContractsMaxOrderByAggregateInput + _min?: Prisma.ContractsMinOrderByAggregateInput + _sum?: Prisma.ContractsSumOrderByAggregateInput +} + +export type ContractsScalarWhereWithAggregatesInput = { + AND?: Prisma.ContractsScalarWhereWithAggregatesInput | Prisma.ContractsScalarWhereWithAggregatesInput[] + OR?: Prisma.ContractsScalarWhereWithAggregatesInput[] + NOT?: Prisma.ContractsScalarWhereWithAggregatesInput | Prisma.ContractsScalarWhereWithAggregatesInput[] + id?: Prisma.IntWithAggregatesFilter<"Contracts"> | number + employee_id?: Prisma.IntWithAggregatesFilter<"Contracts"> | number + daily_expected_hours?: Prisma.IntWithAggregatesFilter<"Contracts"> | number + applicable_overtime?: Prisma.EnumApplicableOvertimeNullableListFilter<"Contracts"> + phone_allocation?: Prisma.DecimalWithAggregatesFilter<"Contracts"> | runtime.Decimal | runtime.DecimalJsLike | number | string + on_call_allocation?: Prisma.DecimalWithAggregatesFilter<"Contracts"> | runtime.Decimal | runtime.DecimalJsLike | number | string + weekend_on_call_allocation?: Prisma.DecimalWithAggregatesFilter<"Contracts"> | runtime.Decimal | runtime.DecimalJsLike | number | string +} + +export type ContractsCreateInput = { + daily_expected_hours?: number + applicable_overtime?: Prisma.ContractsCreateapplicable_overtimeInput | $Enums.ApplicableOvertime[] + phone_allocation?: runtime.Decimal | runtime.DecimalJsLike | number | string + on_call_allocation?: runtime.Decimal | runtime.DecimalJsLike | number | string + weekend_on_call_allocation?: runtime.Decimal | runtime.DecimalJsLike | number | string + employee: Prisma.EmployeesCreateNestedOneWithoutContractsInput +} + +export type ContractsUncheckedCreateInput = { + id?: number + employee_id: number + daily_expected_hours?: number + applicable_overtime?: Prisma.ContractsCreateapplicable_overtimeInput | $Enums.ApplicableOvertime[] + phone_allocation?: runtime.Decimal | runtime.DecimalJsLike | number | string + on_call_allocation?: runtime.Decimal | runtime.DecimalJsLike | number | string + weekend_on_call_allocation?: runtime.Decimal | runtime.DecimalJsLike | number | string +} + +export type ContractsUpdateInput = { + daily_expected_hours?: Prisma.IntFieldUpdateOperationsInput | number + applicable_overtime?: Prisma.ContractsUpdateapplicable_overtimeInput | $Enums.ApplicableOvertime[] + phone_allocation?: Prisma.DecimalFieldUpdateOperationsInput | runtime.Decimal | runtime.DecimalJsLike | number | string + on_call_allocation?: Prisma.DecimalFieldUpdateOperationsInput | runtime.Decimal | runtime.DecimalJsLike | number | string + weekend_on_call_allocation?: Prisma.DecimalFieldUpdateOperationsInput | runtime.Decimal | runtime.DecimalJsLike | number | string + employee?: Prisma.EmployeesUpdateOneRequiredWithoutContractsNestedInput +} + +export type ContractsUncheckedUpdateInput = { + id?: Prisma.IntFieldUpdateOperationsInput | number + employee_id?: Prisma.IntFieldUpdateOperationsInput | number + daily_expected_hours?: Prisma.IntFieldUpdateOperationsInput | number + applicable_overtime?: Prisma.ContractsUpdateapplicable_overtimeInput | $Enums.ApplicableOvertime[] + phone_allocation?: Prisma.DecimalFieldUpdateOperationsInput | runtime.Decimal | runtime.DecimalJsLike | number | string + on_call_allocation?: Prisma.DecimalFieldUpdateOperationsInput | runtime.Decimal | runtime.DecimalJsLike | number | string + weekend_on_call_allocation?: Prisma.DecimalFieldUpdateOperationsInput | runtime.Decimal | runtime.DecimalJsLike | number | string +} + +export type ContractsCreateManyInput = { + id?: number + employee_id: number + daily_expected_hours?: number + applicable_overtime?: Prisma.ContractsCreateapplicable_overtimeInput | $Enums.ApplicableOvertime[] + phone_allocation?: runtime.Decimal | runtime.DecimalJsLike | number | string + on_call_allocation?: runtime.Decimal | runtime.DecimalJsLike | number | string + weekend_on_call_allocation?: runtime.Decimal | runtime.DecimalJsLike | number | string +} + +export type ContractsUpdateManyMutationInput = { + daily_expected_hours?: Prisma.IntFieldUpdateOperationsInput | number + applicable_overtime?: Prisma.ContractsUpdateapplicable_overtimeInput | $Enums.ApplicableOvertime[] + phone_allocation?: Prisma.DecimalFieldUpdateOperationsInput | runtime.Decimal | runtime.DecimalJsLike | number | string + on_call_allocation?: Prisma.DecimalFieldUpdateOperationsInput | runtime.Decimal | runtime.DecimalJsLike | number | string + weekend_on_call_allocation?: Prisma.DecimalFieldUpdateOperationsInput | runtime.Decimal | runtime.DecimalJsLike | number | string +} + +export type ContractsUncheckedUpdateManyInput = { + id?: Prisma.IntFieldUpdateOperationsInput | number + employee_id?: Prisma.IntFieldUpdateOperationsInput | number + daily_expected_hours?: Prisma.IntFieldUpdateOperationsInput | number + applicable_overtime?: Prisma.ContractsUpdateapplicable_overtimeInput | $Enums.ApplicableOvertime[] + phone_allocation?: Prisma.DecimalFieldUpdateOperationsInput | runtime.Decimal | runtime.DecimalJsLike | number | string + on_call_allocation?: Prisma.DecimalFieldUpdateOperationsInput | runtime.Decimal | runtime.DecimalJsLike | number | string + weekend_on_call_allocation?: Prisma.DecimalFieldUpdateOperationsInput | runtime.Decimal | runtime.DecimalJsLike | number | string +} + +export type ContractsNullableScalarRelationFilter = { + is?: Prisma.ContractsWhereInput | null + isNot?: Prisma.ContractsWhereInput | null +} + +export type EnumApplicableOvertimeNullableListFilter<$PrismaModel = never> = { + equals?: $Enums.ApplicableOvertime[] | Prisma.ListEnumApplicableOvertimeFieldRefInput<$PrismaModel> | null + has?: $Enums.ApplicableOvertime | Prisma.EnumApplicableOvertimeFieldRefInput<$PrismaModel> | null + hasEvery?: $Enums.ApplicableOvertime[] | Prisma.ListEnumApplicableOvertimeFieldRefInput<$PrismaModel> + hasSome?: $Enums.ApplicableOvertime[] | Prisma.ListEnumApplicableOvertimeFieldRefInput<$PrismaModel> + isEmpty?: boolean +} + +export type ContractsCountOrderByAggregateInput = { + id?: Prisma.SortOrder + employee_id?: Prisma.SortOrder + daily_expected_hours?: Prisma.SortOrder + applicable_overtime?: Prisma.SortOrder + phone_allocation?: Prisma.SortOrder + on_call_allocation?: Prisma.SortOrder + weekend_on_call_allocation?: Prisma.SortOrder +} + +export type ContractsAvgOrderByAggregateInput = { + id?: Prisma.SortOrder + employee_id?: Prisma.SortOrder + daily_expected_hours?: Prisma.SortOrder + phone_allocation?: Prisma.SortOrder + on_call_allocation?: Prisma.SortOrder + weekend_on_call_allocation?: Prisma.SortOrder +} + +export type ContractsMaxOrderByAggregateInput = { + id?: Prisma.SortOrder + employee_id?: Prisma.SortOrder + daily_expected_hours?: Prisma.SortOrder + phone_allocation?: Prisma.SortOrder + on_call_allocation?: Prisma.SortOrder + weekend_on_call_allocation?: Prisma.SortOrder +} + +export type ContractsMinOrderByAggregateInput = { + id?: Prisma.SortOrder + employee_id?: Prisma.SortOrder + daily_expected_hours?: Prisma.SortOrder + phone_allocation?: Prisma.SortOrder + on_call_allocation?: Prisma.SortOrder + weekend_on_call_allocation?: Prisma.SortOrder +} + +export type ContractsSumOrderByAggregateInput = { + id?: Prisma.SortOrder + employee_id?: Prisma.SortOrder + daily_expected_hours?: Prisma.SortOrder + phone_allocation?: Prisma.SortOrder + on_call_allocation?: Prisma.SortOrder + weekend_on_call_allocation?: Prisma.SortOrder +} + +export type ContractsCreateNestedOneWithoutEmployeeInput = { + create?: Prisma.XOR + connectOrCreate?: Prisma.ContractsCreateOrConnectWithoutEmployeeInput + connect?: Prisma.ContractsWhereUniqueInput +} + +export type ContractsUncheckedCreateNestedOneWithoutEmployeeInput = { + create?: Prisma.XOR + connectOrCreate?: Prisma.ContractsCreateOrConnectWithoutEmployeeInput + connect?: Prisma.ContractsWhereUniqueInput +} + +export type ContractsUpdateOneWithoutEmployeeNestedInput = { + create?: Prisma.XOR + connectOrCreate?: Prisma.ContractsCreateOrConnectWithoutEmployeeInput + upsert?: Prisma.ContractsUpsertWithoutEmployeeInput + disconnect?: Prisma.ContractsWhereInput | boolean + delete?: Prisma.ContractsWhereInput | boolean + connect?: Prisma.ContractsWhereUniqueInput + update?: Prisma.XOR, Prisma.ContractsUncheckedUpdateWithoutEmployeeInput> +} + +export type ContractsUncheckedUpdateOneWithoutEmployeeNestedInput = { + create?: Prisma.XOR + connectOrCreate?: Prisma.ContractsCreateOrConnectWithoutEmployeeInput + upsert?: Prisma.ContractsUpsertWithoutEmployeeInput + disconnect?: Prisma.ContractsWhereInput | boolean + delete?: Prisma.ContractsWhereInput | boolean + connect?: Prisma.ContractsWhereUniqueInput + update?: Prisma.XOR, Prisma.ContractsUncheckedUpdateWithoutEmployeeInput> +} + +export type ContractsCreateapplicable_overtimeInput = { + set: $Enums.ApplicableOvertime[] +} + +export type ContractsUpdateapplicable_overtimeInput = { + set?: $Enums.ApplicableOvertime[] + push?: $Enums.ApplicableOvertime | $Enums.ApplicableOvertime[] +} + +export type DecimalFieldUpdateOperationsInput = { + set?: runtime.Decimal | runtime.DecimalJsLike | number | string + increment?: runtime.Decimal | runtime.DecimalJsLike | number | string + decrement?: runtime.Decimal | runtime.DecimalJsLike | number | string + multiply?: runtime.Decimal | runtime.DecimalJsLike | number | string + divide?: runtime.Decimal | runtime.DecimalJsLike | number | string +} + +export type ContractsCreateWithoutEmployeeInput = { + daily_expected_hours?: number + applicable_overtime?: Prisma.ContractsCreateapplicable_overtimeInput | $Enums.ApplicableOvertime[] + phone_allocation?: runtime.Decimal | runtime.DecimalJsLike | number | string + on_call_allocation?: runtime.Decimal | runtime.DecimalJsLike | number | string + weekend_on_call_allocation?: runtime.Decimal | runtime.DecimalJsLike | number | string +} + +export type ContractsUncheckedCreateWithoutEmployeeInput = { + id?: number + daily_expected_hours?: number + applicable_overtime?: Prisma.ContractsCreateapplicable_overtimeInput | $Enums.ApplicableOvertime[] + phone_allocation?: runtime.Decimal | runtime.DecimalJsLike | number | string + on_call_allocation?: runtime.Decimal | runtime.DecimalJsLike | number | string + weekend_on_call_allocation?: runtime.Decimal | runtime.DecimalJsLike | number | string +} + +export type ContractsCreateOrConnectWithoutEmployeeInput = { + where: Prisma.ContractsWhereUniqueInput + create: Prisma.XOR +} + +export type ContractsUpsertWithoutEmployeeInput = { + update: Prisma.XOR + create: Prisma.XOR + where?: Prisma.ContractsWhereInput +} + +export type ContractsUpdateToOneWithWhereWithoutEmployeeInput = { + where?: Prisma.ContractsWhereInput + data: Prisma.XOR +} + +export type ContractsUpdateWithoutEmployeeInput = { + daily_expected_hours?: Prisma.IntFieldUpdateOperationsInput | number + applicable_overtime?: Prisma.ContractsUpdateapplicable_overtimeInput | $Enums.ApplicableOvertime[] + phone_allocation?: Prisma.DecimalFieldUpdateOperationsInput | runtime.Decimal | runtime.DecimalJsLike | number | string + on_call_allocation?: Prisma.DecimalFieldUpdateOperationsInput | runtime.Decimal | runtime.DecimalJsLike | number | string + weekend_on_call_allocation?: Prisma.DecimalFieldUpdateOperationsInput | runtime.Decimal | runtime.DecimalJsLike | number | string +} + +export type ContractsUncheckedUpdateWithoutEmployeeInput = { + id?: Prisma.IntFieldUpdateOperationsInput | number + daily_expected_hours?: Prisma.IntFieldUpdateOperationsInput | number + applicable_overtime?: Prisma.ContractsUpdateapplicable_overtimeInput | $Enums.ApplicableOvertime[] + phone_allocation?: Prisma.DecimalFieldUpdateOperationsInput | runtime.Decimal | runtime.DecimalJsLike | number | string + on_call_allocation?: Prisma.DecimalFieldUpdateOperationsInput | runtime.Decimal | runtime.DecimalJsLike | number | string + weekend_on_call_allocation?: Prisma.DecimalFieldUpdateOperationsInput | runtime.Decimal | runtime.DecimalJsLike | number | string +} + + + +export type ContractsSelect = runtime.Types.Extensions.GetSelect<{ + id?: boolean + employee_id?: boolean + daily_expected_hours?: boolean + applicable_overtime?: boolean + phone_allocation?: boolean + on_call_allocation?: boolean + weekend_on_call_allocation?: boolean + employee?: boolean | Prisma.EmployeesDefaultArgs +}, ExtArgs["result"]["contracts"]> + +export type ContractsSelectCreateManyAndReturn = runtime.Types.Extensions.GetSelect<{ + id?: boolean + employee_id?: boolean + daily_expected_hours?: boolean + applicable_overtime?: boolean + phone_allocation?: boolean + on_call_allocation?: boolean + weekend_on_call_allocation?: boolean + employee?: boolean | Prisma.EmployeesDefaultArgs +}, ExtArgs["result"]["contracts"]> + +export type ContractsSelectUpdateManyAndReturn = runtime.Types.Extensions.GetSelect<{ + id?: boolean + employee_id?: boolean + daily_expected_hours?: boolean + applicable_overtime?: boolean + phone_allocation?: boolean + on_call_allocation?: boolean + weekend_on_call_allocation?: boolean + employee?: boolean | Prisma.EmployeesDefaultArgs +}, ExtArgs["result"]["contracts"]> + +export type ContractsSelectScalar = { + id?: boolean + employee_id?: boolean + daily_expected_hours?: boolean + applicable_overtime?: boolean + phone_allocation?: boolean + on_call_allocation?: boolean + weekend_on_call_allocation?: boolean +} + +export type ContractsOmit = runtime.Types.Extensions.GetOmit<"id" | "employee_id" | "daily_expected_hours" | "applicable_overtime" | "phone_allocation" | "on_call_allocation" | "weekend_on_call_allocation", ExtArgs["result"]["contracts"]> +export type ContractsInclude = { + employee?: boolean | Prisma.EmployeesDefaultArgs +} +export type ContractsIncludeCreateManyAndReturn = { + employee?: boolean | Prisma.EmployeesDefaultArgs +} +export type ContractsIncludeUpdateManyAndReturn = { + employee?: boolean | Prisma.EmployeesDefaultArgs +} + +export type $ContractsPayload = { + name: "Contracts" + objects: { + employee: Prisma.$EmployeesPayload + } + scalars: runtime.Types.Extensions.GetPayloadResult<{ + id: number + employee_id: number + daily_expected_hours: number + applicable_overtime: $Enums.ApplicableOvertime[] + phone_allocation: runtime.Decimal + on_call_allocation: runtime.Decimal + weekend_on_call_allocation: runtime.Decimal + }, ExtArgs["result"]["contracts"]> + composites: {} +} + +export type ContractsGetPayload = runtime.Types.Result.GetResult + +export type ContractsCountArgs = + Omit & { + select?: ContractsCountAggregateInputType | true + } + +export interface ContractsDelegate { + [K: symbol]: { types: Prisma.TypeMap['model']['Contracts'], meta: { name: 'Contracts' } } + /** + * Find zero or one Contracts that matches the filter. + * @param {ContractsFindUniqueArgs} args - Arguments to find a Contracts + * @example + * // Get one Contracts + * const contracts = await prisma.contracts.findUnique({ + * where: { + * // ... provide filter here + * } + * }) + */ + findUnique(args: Prisma.SelectSubset>): Prisma.Prisma__ContractsClient, T, "findUnique", GlobalOmitOptions> | null, null, ExtArgs, GlobalOmitOptions> + + /** + * Find one Contracts that matches the filter or throw an error with `error.code='P2025'` + * if no matches were found. + * @param {ContractsFindUniqueOrThrowArgs} args - Arguments to find a Contracts + * @example + * // Get one Contracts + * const contracts = await prisma.contracts.findUniqueOrThrow({ + * where: { + * // ... provide filter here + * } + * }) + */ + findUniqueOrThrow(args: Prisma.SelectSubset>): Prisma.Prisma__ContractsClient, T, "findUniqueOrThrow", GlobalOmitOptions>, never, ExtArgs, GlobalOmitOptions> + + /** + * Find the first Contracts that matches the filter. + * Note, that providing `undefined` is treated as the value not being there. + * Read more here: https://pris.ly/d/null-undefined + * @param {ContractsFindFirstArgs} args - Arguments to find a Contracts + * @example + * // Get one Contracts + * const contracts = await prisma.contracts.findFirst({ + * where: { + * // ... provide filter here + * } + * }) + */ + findFirst(args?: Prisma.SelectSubset>): Prisma.Prisma__ContractsClient, T, "findFirst", GlobalOmitOptions> | null, null, ExtArgs, GlobalOmitOptions> + + /** + * Find the first Contracts that matches the filter or + * throw `PrismaKnownClientError` with `P2025` code if no matches were found. + * Note, that providing `undefined` is treated as the value not being there. + * Read more here: https://pris.ly/d/null-undefined + * @param {ContractsFindFirstOrThrowArgs} args - Arguments to find a Contracts + * @example + * // Get one Contracts + * const contracts = await prisma.contracts.findFirstOrThrow({ + * where: { + * // ... provide filter here + * } + * }) + */ + findFirstOrThrow(args?: Prisma.SelectSubset>): Prisma.Prisma__ContractsClient, T, "findFirstOrThrow", GlobalOmitOptions>, never, ExtArgs, GlobalOmitOptions> + + /** + * Find zero or more Contracts that matches the filter. + * Note, that providing `undefined` is treated as the value not being there. + * Read more here: https://pris.ly/d/null-undefined + * @param {ContractsFindManyArgs} args - Arguments to filter and select certain fields only. + * @example + * // Get all Contracts + * const contracts = await prisma.contracts.findMany() + * + * // Get first 10 Contracts + * const contracts = await prisma.contracts.findMany({ take: 10 }) + * + * // Only select the `id` + * const contractsWithIdOnly = await prisma.contracts.findMany({ select: { id: true } }) + * + */ + findMany(args?: Prisma.SelectSubset>): Prisma.PrismaPromise, T, "findMany", GlobalOmitOptions>> + + /** + * Create a Contracts. + * @param {ContractsCreateArgs} args - Arguments to create a Contracts. + * @example + * // Create one Contracts + * const Contracts = await prisma.contracts.create({ + * data: { + * // ... data to create a Contracts + * } + * }) + * + */ + create(args: Prisma.SelectSubset>): Prisma.Prisma__ContractsClient, T, "create", GlobalOmitOptions>, never, ExtArgs, GlobalOmitOptions> + + /** + * Create many Contracts. + * @param {ContractsCreateManyArgs} args - Arguments to create many Contracts. + * @example + * // Create many Contracts + * const contracts = await prisma.contracts.createMany({ + * data: [ + * // ... provide data here + * ] + * }) + * + */ + createMany(args?: Prisma.SelectSubset>): Prisma.PrismaPromise + + /** + * Create many Contracts and returns the data saved in the database. + * @param {ContractsCreateManyAndReturnArgs} args - Arguments to create many Contracts. + * @example + * // Create many Contracts + * const contracts = await prisma.contracts.createManyAndReturn({ + * data: [ + * // ... provide data here + * ] + * }) + * + * // Create many Contracts and only return the `id` + * const contractsWithIdOnly = await prisma.contracts.createManyAndReturn({ + * select: { id: true }, + * data: [ + * // ... provide data here + * ] + * }) + * Note, that providing `undefined` is treated as the value not being there. + * Read more here: https://pris.ly/d/null-undefined + * + */ + createManyAndReturn(args?: Prisma.SelectSubset>): Prisma.PrismaPromise, T, "createManyAndReturn", GlobalOmitOptions>> + + /** + * Delete a Contracts. + * @param {ContractsDeleteArgs} args - Arguments to delete one Contracts. + * @example + * // Delete one Contracts + * const Contracts = await prisma.contracts.delete({ + * where: { + * // ... filter to delete one Contracts + * } + * }) + * + */ + delete(args: Prisma.SelectSubset>): Prisma.Prisma__ContractsClient, T, "delete", GlobalOmitOptions>, never, ExtArgs, GlobalOmitOptions> + + /** + * Update one Contracts. + * @param {ContractsUpdateArgs} args - Arguments to update one Contracts. + * @example + * // Update one Contracts + * const contracts = await prisma.contracts.update({ + * where: { + * // ... provide filter here + * }, + * data: { + * // ... provide data here + * } + * }) + * + */ + update(args: Prisma.SelectSubset>): Prisma.Prisma__ContractsClient, T, "update", GlobalOmitOptions>, never, ExtArgs, GlobalOmitOptions> + + /** + * Delete zero or more Contracts. + * @param {ContractsDeleteManyArgs} args - Arguments to filter Contracts to delete. + * @example + * // Delete a few Contracts + * const { count } = await prisma.contracts.deleteMany({ + * where: { + * // ... provide filter here + * } + * }) + * + */ + deleteMany(args?: Prisma.SelectSubset>): Prisma.PrismaPromise + + /** + * Update zero or more Contracts. + * Note, that providing `undefined` is treated as the value not being there. + * Read more here: https://pris.ly/d/null-undefined + * @param {ContractsUpdateManyArgs} args - Arguments to update one or more rows. + * @example + * // Update many Contracts + * const contracts = await prisma.contracts.updateMany({ + * where: { + * // ... provide filter here + * }, + * data: { + * // ... provide data here + * } + * }) + * + */ + updateMany(args: Prisma.SelectSubset>): Prisma.PrismaPromise + + /** + * Update zero or more Contracts and returns the data updated in the database. + * @param {ContractsUpdateManyAndReturnArgs} args - Arguments to update many Contracts. + * @example + * // Update many Contracts + * const contracts = await prisma.contracts.updateManyAndReturn({ + * where: { + * // ... provide filter here + * }, + * data: [ + * // ... provide data here + * ] + * }) + * + * // Update zero or more Contracts and only return the `id` + * const contractsWithIdOnly = await prisma.contracts.updateManyAndReturn({ + * select: { id: true }, + * where: { + * // ... provide filter here + * }, + * data: [ + * // ... provide data here + * ] + * }) + * Note, that providing `undefined` is treated as the value not being there. + * Read more here: https://pris.ly/d/null-undefined + * + */ + updateManyAndReturn(args: Prisma.SelectSubset>): Prisma.PrismaPromise, T, "updateManyAndReturn", GlobalOmitOptions>> + + /** + * Create or update one Contracts. + * @param {ContractsUpsertArgs} args - Arguments to update or create a Contracts. + * @example + * // Update or create a Contracts + * const contracts = await prisma.contracts.upsert({ + * create: { + * // ... data to create a Contracts + * }, + * update: { + * // ... in case it already exists, update + * }, + * where: { + * // ... the filter for the Contracts we want to update + * } + * }) + */ + upsert(args: Prisma.SelectSubset>): Prisma.Prisma__ContractsClient, T, "upsert", GlobalOmitOptions>, never, ExtArgs, GlobalOmitOptions> + + + /** + * Count the number of Contracts. + * Note, that providing `undefined` is treated as the value not being there. + * Read more here: https://pris.ly/d/null-undefined + * @param {ContractsCountArgs} args - Arguments to filter Contracts to count. + * @example + * // Count the number of Contracts + * const count = await prisma.contracts.count({ + * where: { + * // ... the filter for the Contracts we want to count + * } + * }) + **/ + count( + args?: Prisma.Subset, + ): Prisma.PrismaPromise< + T extends runtime.Types.Utils.Record<'select', any> + ? T['select'] extends true + ? number + : Prisma.GetScalarType + : number + > + + /** + * Allows you to perform aggregations operations on a Contracts. + * Note, that providing `undefined` is treated as the value not being there. + * Read more here: https://pris.ly/d/null-undefined + * @param {ContractsAggregateArgs} args - Select which aggregations you would like to apply and on what fields. + * @example + * // Ordered by age ascending + * // Where email contains prisma.io + * // Limited to the 10 users + * const aggregations = await prisma.user.aggregate({ + * _avg: { + * age: true, + * }, + * where: { + * email: { + * contains: "prisma.io", + * }, + * }, + * orderBy: { + * age: "asc", + * }, + * take: 10, + * }) + **/ + aggregate(args: Prisma.Subset): Prisma.PrismaPromise> + + /** + * Group by Contracts. + * Note, that providing `undefined` is treated as the value not being there. + * Read more here: https://pris.ly/d/null-undefined + * @param {ContractsGroupByArgs} args - Group by arguments. + * @example + * // Group by city, order by createdAt, get count + * const result = await prisma.user.groupBy({ + * by: ['city', 'createdAt'], + * orderBy: { + * createdAt: true + * }, + * _count: { + * _all: true + * }, + * }) + * + **/ + groupBy< + T extends ContractsGroupByArgs, + HasSelectOrTake extends Prisma.Or< + Prisma.Extends<'skip', Prisma.Keys>, + Prisma.Extends<'take', Prisma.Keys> + >, + OrderByArg extends Prisma.True extends HasSelectOrTake + ? { orderBy: ContractsGroupByArgs['orderBy'] } + : { orderBy?: ContractsGroupByArgs['orderBy'] }, + OrderFields extends Prisma.ExcludeUnderscoreKeys>>, + ByFields extends Prisma.MaybeTupleToUnion, + ByValid extends Prisma.Has, + HavingFields extends Prisma.GetHavingFields, + HavingValid extends Prisma.Has, + ByEmpty extends T['by'] extends never[] ? Prisma.True : Prisma.False, + InputErrors extends ByEmpty extends Prisma.True + ? `Error: "by" must not be empty.` + : HavingValid extends Prisma.False + ? { + [P in HavingFields]: P extends ByFields + ? never + : P extends string + ? `Error: Field "${P}" used in "having" needs to be provided in "by".` + : [ + Error, + 'Field ', + P, + ` in "having" needs to be provided in "by"`, + ] + }[HavingFields] + : 'take' extends Prisma.Keys + ? 'orderBy' extends Prisma.Keys + ? ByValid extends Prisma.True + ? {} + : { + [P in OrderFields]: P extends ByFields + ? never + : `Error: Field "${P}" in "orderBy" needs to be provided in "by"` + }[OrderFields] + : 'Error: If you provide "take", you also need to provide "orderBy"' + : 'skip' extends Prisma.Keys + ? 'orderBy' extends Prisma.Keys + ? ByValid extends Prisma.True + ? {} + : { + [P in OrderFields]: P extends ByFields + ? never + : `Error: Field "${P}" in "orderBy" needs to be provided in "by"` + }[OrderFields] + : 'Error: If you provide "skip", you also need to provide "orderBy"' + : ByValid extends Prisma.True + ? {} + : { + [P in OrderFields]: P extends ByFields + ? never + : `Error: Field "${P}" in "orderBy" needs to be provided in "by"` + }[OrderFields] + >(args: Prisma.SubsetIntersection & InputErrors): {} extends InputErrors ? GetContractsGroupByPayload : Prisma.PrismaPromise +/** + * Fields of the Contracts model + */ +readonly fields: ContractsFieldRefs; +} + +/** + * The delegate class that acts as a "Promise-like" for Contracts. + * Why is this prefixed with `Prisma__`? + * Because we want to prevent naming conflicts as mentioned in + * https://github.com/prisma/prisma-client-js/issues/707 + */ +export interface Prisma__ContractsClient extends Prisma.PrismaPromise { + readonly [Symbol.toStringTag]: "PrismaPromise" + employee = {}>(args?: Prisma.Subset>): Prisma.Prisma__EmployeesClient, T, "findUniqueOrThrow", GlobalOmitOptions> | Null, Null, ExtArgs, GlobalOmitOptions> + /** + * Attaches callbacks for the resolution and/or rejection of the Promise. + * @param onfulfilled The callback to execute when the Promise is resolved. + * @param onrejected The callback to execute when the Promise is rejected. + * @returns A Promise for the completion of which ever callback is executed. + */ + then(onfulfilled?: ((value: T) => TResult1 | PromiseLike) | undefined | null, onrejected?: ((reason: any) => TResult2 | PromiseLike) | undefined | null): runtime.Types.Utils.JsPromise + /** + * Attaches a callback for only the rejection of the Promise. + * @param onrejected The callback to execute when the Promise is rejected. + * @returns A Promise for the completion of the callback. + */ + catch(onrejected?: ((reason: any) => TResult | PromiseLike) | undefined | null): runtime.Types.Utils.JsPromise + /** + * Attaches a callback that is invoked when the Promise is settled (fulfilled or rejected). The + * resolved value cannot be modified from the callback. + * @param onfinally The callback to execute when the Promise is settled (fulfilled or rejected). + * @returns A Promise for the completion of the callback. + */ + finally(onfinally?: (() => void) | undefined | null): runtime.Types.Utils.JsPromise +} + + + + +/** + * Fields of the Contracts model + */ +export interface ContractsFieldRefs { + readonly id: Prisma.FieldRef<"Contracts", 'Int'> + readonly employee_id: Prisma.FieldRef<"Contracts", 'Int'> + readonly daily_expected_hours: Prisma.FieldRef<"Contracts", 'Int'> + readonly applicable_overtime: Prisma.FieldRef<"Contracts", 'ApplicableOvertime[]'> + readonly phone_allocation: Prisma.FieldRef<"Contracts", 'Decimal'> + readonly on_call_allocation: Prisma.FieldRef<"Contracts", 'Decimal'> + readonly weekend_on_call_allocation: Prisma.FieldRef<"Contracts", 'Decimal'> +} + + +// Custom InputTypes +/** + * Contracts findUnique + */ +export type ContractsFindUniqueArgs = { + /** + * Select specific fields to fetch from the Contracts + */ + select?: Prisma.ContractsSelect | null + /** + * Omit specific fields from the Contracts + */ + omit?: Prisma.ContractsOmit | null + /** + * Choose, which related nodes to fetch as well + */ + include?: Prisma.ContractsInclude | null + /** + * Filter, which Contracts to fetch. + */ + where: Prisma.ContractsWhereUniqueInput +} + +/** + * Contracts findUniqueOrThrow + */ +export type ContractsFindUniqueOrThrowArgs = { + /** + * Select specific fields to fetch from the Contracts + */ + select?: Prisma.ContractsSelect | null + /** + * Omit specific fields from the Contracts + */ + omit?: Prisma.ContractsOmit | null + /** + * Choose, which related nodes to fetch as well + */ + include?: Prisma.ContractsInclude | null + /** + * Filter, which Contracts to fetch. + */ + where: Prisma.ContractsWhereUniqueInput +} + +/** + * Contracts findFirst + */ +export type ContractsFindFirstArgs = { + /** + * Select specific fields to fetch from the Contracts + */ + select?: Prisma.ContractsSelect | null + /** + * Omit specific fields from the Contracts + */ + omit?: Prisma.ContractsOmit | null + /** + * Choose, which related nodes to fetch as well + */ + include?: Prisma.ContractsInclude | null + /** + * Filter, which Contracts to fetch. + */ + where?: Prisma.ContractsWhereInput + /** + * {@link https://www.prisma.io/docs/concepts/components/prisma-client/sorting Sorting Docs} + * + * Determine the order of Contracts to fetch. + */ + orderBy?: Prisma.ContractsOrderByWithRelationInput | Prisma.ContractsOrderByWithRelationInput[] + /** + * {@link https://www.prisma.io/docs/concepts/components/prisma-client/pagination#cursor-based-pagination Cursor Docs} + * + * Sets the position for searching for Contracts. + */ + cursor?: Prisma.ContractsWhereUniqueInput + /** + * {@link https://www.prisma.io/docs/concepts/components/prisma-client/pagination Pagination Docs} + * + * Take `±n` Contracts from the position of the cursor. + */ + take?: number + /** + * {@link https://www.prisma.io/docs/concepts/components/prisma-client/pagination Pagination Docs} + * + * Skip the first `n` Contracts. + */ + skip?: number + /** + * {@link https://www.prisma.io/docs/concepts/components/prisma-client/distinct Distinct Docs} + * + * Filter by unique combinations of Contracts. + */ + distinct?: Prisma.ContractsScalarFieldEnum | Prisma.ContractsScalarFieldEnum[] +} + +/** + * Contracts findFirstOrThrow + */ +export type ContractsFindFirstOrThrowArgs = { + /** + * Select specific fields to fetch from the Contracts + */ + select?: Prisma.ContractsSelect | null + /** + * Omit specific fields from the Contracts + */ + omit?: Prisma.ContractsOmit | null + /** + * Choose, which related nodes to fetch as well + */ + include?: Prisma.ContractsInclude | null + /** + * Filter, which Contracts to fetch. + */ + where?: Prisma.ContractsWhereInput + /** + * {@link https://www.prisma.io/docs/concepts/components/prisma-client/sorting Sorting Docs} + * + * Determine the order of Contracts to fetch. + */ + orderBy?: Prisma.ContractsOrderByWithRelationInput | Prisma.ContractsOrderByWithRelationInput[] + /** + * {@link https://www.prisma.io/docs/concepts/components/prisma-client/pagination#cursor-based-pagination Cursor Docs} + * + * Sets the position for searching for Contracts. + */ + cursor?: Prisma.ContractsWhereUniqueInput + /** + * {@link https://www.prisma.io/docs/concepts/components/prisma-client/pagination Pagination Docs} + * + * Take `±n` Contracts from the position of the cursor. + */ + take?: number + /** + * {@link https://www.prisma.io/docs/concepts/components/prisma-client/pagination Pagination Docs} + * + * Skip the first `n` Contracts. + */ + skip?: number + /** + * {@link https://www.prisma.io/docs/concepts/components/prisma-client/distinct Distinct Docs} + * + * Filter by unique combinations of Contracts. + */ + distinct?: Prisma.ContractsScalarFieldEnum | Prisma.ContractsScalarFieldEnum[] +} + +/** + * Contracts findMany + */ +export type ContractsFindManyArgs = { + /** + * Select specific fields to fetch from the Contracts + */ + select?: Prisma.ContractsSelect | null + /** + * Omit specific fields from the Contracts + */ + omit?: Prisma.ContractsOmit | null + /** + * Choose, which related nodes to fetch as well + */ + include?: Prisma.ContractsInclude | null + /** + * Filter, which Contracts to fetch. + */ + where?: Prisma.ContractsWhereInput + /** + * {@link https://www.prisma.io/docs/concepts/components/prisma-client/sorting Sorting Docs} + * + * Determine the order of Contracts to fetch. + */ + orderBy?: Prisma.ContractsOrderByWithRelationInput | Prisma.ContractsOrderByWithRelationInput[] + /** + * {@link https://www.prisma.io/docs/concepts/components/prisma-client/pagination#cursor-based-pagination Cursor Docs} + * + * Sets the position for listing Contracts. + */ + cursor?: Prisma.ContractsWhereUniqueInput + /** + * {@link https://www.prisma.io/docs/concepts/components/prisma-client/pagination Pagination Docs} + * + * Take `±n` Contracts from the position of the cursor. + */ + take?: number + /** + * {@link https://www.prisma.io/docs/concepts/components/prisma-client/pagination Pagination Docs} + * + * Skip the first `n` Contracts. + */ + skip?: number + distinct?: Prisma.ContractsScalarFieldEnum | Prisma.ContractsScalarFieldEnum[] +} + +/** + * Contracts create + */ +export type ContractsCreateArgs = { + /** + * Select specific fields to fetch from the Contracts + */ + select?: Prisma.ContractsSelect | null + /** + * Omit specific fields from the Contracts + */ + omit?: Prisma.ContractsOmit | null + /** + * Choose, which related nodes to fetch as well + */ + include?: Prisma.ContractsInclude | null + /** + * The data needed to create a Contracts. + */ + data: Prisma.XOR +} + +/** + * Contracts createMany + */ +export type ContractsCreateManyArgs = { + /** + * The data used to create many Contracts. + */ + data: Prisma.ContractsCreateManyInput | Prisma.ContractsCreateManyInput[] + skipDuplicates?: boolean +} + +/** + * Contracts createManyAndReturn + */ +export type ContractsCreateManyAndReturnArgs = { + /** + * Select specific fields to fetch from the Contracts + */ + select?: Prisma.ContractsSelectCreateManyAndReturn | null + /** + * Omit specific fields from the Contracts + */ + omit?: Prisma.ContractsOmit | null + /** + * The data used to create many Contracts. + */ + data: Prisma.ContractsCreateManyInput | Prisma.ContractsCreateManyInput[] + skipDuplicates?: boolean + /** + * Choose, which related nodes to fetch as well + */ + include?: Prisma.ContractsIncludeCreateManyAndReturn | null +} + +/** + * Contracts update + */ +export type ContractsUpdateArgs = { + /** + * Select specific fields to fetch from the Contracts + */ + select?: Prisma.ContractsSelect | null + /** + * Omit specific fields from the Contracts + */ + omit?: Prisma.ContractsOmit | null + /** + * Choose, which related nodes to fetch as well + */ + include?: Prisma.ContractsInclude | null + /** + * The data needed to update a Contracts. + */ + data: Prisma.XOR + /** + * Choose, which Contracts to update. + */ + where: Prisma.ContractsWhereUniqueInput +} + +/** + * Contracts updateMany + */ +export type ContractsUpdateManyArgs = { + /** + * The data used to update Contracts. + */ + data: Prisma.XOR + /** + * Filter which Contracts to update + */ + where?: Prisma.ContractsWhereInput + /** + * Limit how many Contracts to update. + */ + limit?: number +} + +/** + * Contracts updateManyAndReturn + */ +export type ContractsUpdateManyAndReturnArgs = { + /** + * Select specific fields to fetch from the Contracts + */ + select?: Prisma.ContractsSelectUpdateManyAndReturn | null + /** + * Omit specific fields from the Contracts + */ + omit?: Prisma.ContractsOmit | null + /** + * The data used to update Contracts. + */ + data: Prisma.XOR + /** + * Filter which Contracts to update + */ + where?: Prisma.ContractsWhereInput + /** + * Limit how many Contracts to update. + */ + limit?: number + /** + * Choose, which related nodes to fetch as well + */ + include?: Prisma.ContractsIncludeUpdateManyAndReturn | null +} + +/** + * Contracts upsert + */ +export type ContractsUpsertArgs = { + /** + * Select specific fields to fetch from the Contracts + */ + select?: Prisma.ContractsSelect | null + /** + * Omit specific fields from the Contracts + */ + omit?: Prisma.ContractsOmit | null + /** + * Choose, which related nodes to fetch as well + */ + include?: Prisma.ContractsInclude | null + /** + * The filter to search for the Contracts to update in case it exists. + */ + where: Prisma.ContractsWhereUniqueInput + /** + * In case the Contracts found by the `where` argument doesn't exist, create a new Contracts with this data. + */ + create: Prisma.XOR + /** + * In case the Contracts was found with the provided `where` argument, update it with this data. + */ + update: Prisma.XOR +} + +/** + * Contracts delete + */ +export type ContractsDeleteArgs = { + /** + * Select specific fields to fetch from the Contracts + */ + select?: Prisma.ContractsSelect | null + /** + * Omit specific fields from the Contracts + */ + omit?: Prisma.ContractsOmit | null + /** + * Choose, which related nodes to fetch as well + */ + include?: Prisma.ContractsInclude | null + /** + * Filter which Contracts to delete. + */ + where: Prisma.ContractsWhereUniqueInput +} + +/** + * Contracts deleteMany + */ +export type ContractsDeleteManyArgs = { + /** + * Filter which Contracts to delete + */ + where?: Prisma.ContractsWhereInput + /** + * Limit how many Contracts to delete. + */ + limit?: number +} + +/** + * Contracts without action + */ +export type ContractsDefaultArgs = { + /** + * Select specific fields to fetch from the Contracts + */ + select?: Prisma.ContractsSelect | null + /** + * Omit specific fields from the Contracts + */ + omit?: Prisma.ContractsOmit | null + /** + * Choose, which related nodes to fetch as well + */ + include?: Prisma.ContractsInclude | null +} diff --git a/prisma/postgres/generated/prisma/client/postgres/models/Notifications.ts b/prisma/postgres/generated/prisma/client/postgres/models/Notifications.ts new file mode 100644 index 0000000..16d86ac --- /dev/null +++ b/prisma/postgres/generated/prisma/client/postgres/models/Notifications.ts @@ -0,0 +1,1439 @@ + +/* !!! This is code generated by Prisma. Do not edit directly. !!! */ +/* eslint-disable */ +// biome-ignore-all lint: generated file +// @ts-nocheck +/* + * This file exports the `Notifications` model and its related types. + * + * 🟢 You can import this file directly. + */ +import type * as runtime from "@prisma/client/runtime/client" +import type * as $Enums from "../enums" +import type * as Prisma from "../internal/prismaNamespace" + +/** + * Model Notifications + * + */ +export type NotificationsModel = runtime.Types.Result.DefaultSelection + +export type AggregateNotifications = { + _count: NotificationsCountAggregateOutputType | null + _avg: NotificationsAvgAggregateOutputType | null + _sum: NotificationsSumAggregateOutputType | null + _min: NotificationsMinAggregateOutputType | null + _max: NotificationsMaxAggregateOutputType | null +} + +export type NotificationsAvgAggregateOutputType = { + id: number | null +} + +export type NotificationsSumAggregateOutputType = { + id: number | null +} + +export type NotificationsMinAggregateOutputType = { + id: number | null + user_id: string | null + affected_module: $Enums.Modules | null + subject: string | null + description: string | null + created_at: Date | null + viewed_at: Date | null +} + +export type NotificationsMaxAggregateOutputType = { + id: number | null + user_id: string | null + affected_module: $Enums.Modules | null + subject: string | null + description: string | null + created_at: Date | null + viewed_at: Date | null +} + +export type NotificationsCountAggregateOutputType = { + id: number + user_id: number + affected_module: number + subject: number + description: number + metadata: number + created_at: number + viewed_at: number + _all: number +} + + +export type NotificationsAvgAggregateInputType = { + id?: true +} + +export type NotificationsSumAggregateInputType = { + id?: true +} + +export type NotificationsMinAggregateInputType = { + id?: true + user_id?: true + affected_module?: true + subject?: true + description?: true + created_at?: true + viewed_at?: true +} + +export type NotificationsMaxAggregateInputType = { + id?: true + user_id?: true + affected_module?: true + subject?: true + description?: true + created_at?: true + viewed_at?: true +} + +export type NotificationsCountAggregateInputType = { + id?: true + user_id?: true + affected_module?: true + subject?: true + description?: true + metadata?: true + created_at?: true + viewed_at?: true + _all?: true +} + +export type NotificationsAggregateArgs = { + /** + * Filter which Notifications to aggregate. + */ + where?: Prisma.NotificationsWhereInput + /** + * {@link https://www.prisma.io/docs/concepts/components/prisma-client/sorting Sorting Docs} + * + * Determine the order of Notifications to fetch. + */ + orderBy?: Prisma.NotificationsOrderByWithRelationInput | Prisma.NotificationsOrderByWithRelationInput[] + /** + * {@link https://www.prisma.io/docs/concepts/components/prisma-client/pagination#cursor-based-pagination Cursor Docs} + * + * Sets the start position + */ + cursor?: Prisma.NotificationsWhereUniqueInput + /** + * {@link https://www.prisma.io/docs/concepts/components/prisma-client/pagination Pagination Docs} + * + * Take `±n` Notifications from the position of the cursor. + */ + take?: number + /** + * {@link https://www.prisma.io/docs/concepts/components/prisma-client/pagination Pagination Docs} + * + * Skip the first `n` Notifications. + */ + skip?: number + /** + * {@link https://www.prisma.io/docs/concepts/components/prisma-client/aggregations Aggregation Docs} + * + * Count returned Notifications + **/ + _count?: true | NotificationsCountAggregateInputType + /** + * {@link https://www.prisma.io/docs/concepts/components/prisma-client/aggregations Aggregation Docs} + * + * Select which fields to average + **/ + _avg?: NotificationsAvgAggregateInputType + /** + * {@link https://www.prisma.io/docs/concepts/components/prisma-client/aggregations Aggregation Docs} + * + * Select which fields to sum + **/ + _sum?: NotificationsSumAggregateInputType + /** + * {@link https://www.prisma.io/docs/concepts/components/prisma-client/aggregations Aggregation Docs} + * + * Select which fields to find the minimum value + **/ + _min?: NotificationsMinAggregateInputType + /** + * {@link https://www.prisma.io/docs/concepts/components/prisma-client/aggregations Aggregation Docs} + * + * Select which fields to find the maximum value + **/ + _max?: NotificationsMaxAggregateInputType +} + +export type GetNotificationsAggregateType = { + [P in keyof T & keyof AggregateNotifications]: P extends '_count' | 'count' + ? T[P] extends true + ? number + : Prisma.GetScalarType + : Prisma.GetScalarType +} + + + + +export type NotificationsGroupByArgs = { + where?: Prisma.NotificationsWhereInput + orderBy?: Prisma.NotificationsOrderByWithAggregationInput | Prisma.NotificationsOrderByWithAggregationInput[] + by: Prisma.NotificationsScalarFieldEnum[] | Prisma.NotificationsScalarFieldEnum + having?: Prisma.NotificationsScalarWhereWithAggregatesInput + take?: number + skip?: number + _count?: NotificationsCountAggregateInputType | true + _avg?: NotificationsAvgAggregateInputType + _sum?: NotificationsSumAggregateInputType + _min?: NotificationsMinAggregateInputType + _max?: NotificationsMaxAggregateInputType +} + +export type NotificationsGroupByOutputType = { + id: number + user_id: string + affected_module: $Enums.Modules + subject: string + description: string + metadata: runtime.JsonValue + created_at: Date + viewed_at: Date | null + _count: NotificationsCountAggregateOutputType | null + _avg: NotificationsAvgAggregateOutputType | null + _sum: NotificationsSumAggregateOutputType | null + _min: NotificationsMinAggregateOutputType | null + _max: NotificationsMaxAggregateOutputType | null +} + +type GetNotificationsGroupByPayload = Prisma.PrismaPromise< + Array< + Prisma.PickEnumerable & + { + [P in ((keyof T) & (keyof NotificationsGroupByOutputType))]: P extends '_count' + ? T[P] extends boolean + ? number + : Prisma.GetScalarType + : Prisma.GetScalarType + } + > + > + + + +export type NotificationsWhereInput = { + AND?: Prisma.NotificationsWhereInput | Prisma.NotificationsWhereInput[] + OR?: Prisma.NotificationsWhereInput[] + NOT?: Prisma.NotificationsWhereInput | Prisma.NotificationsWhereInput[] + id?: Prisma.IntFilter<"Notifications"> | number + user_id?: Prisma.UuidFilter<"Notifications"> | string + affected_module?: Prisma.EnumModulesFilter<"Notifications"> | $Enums.Modules + subject?: Prisma.StringFilter<"Notifications"> | string + description?: Prisma.StringFilter<"Notifications"> | string + metadata?: Prisma.JsonFilter<"Notifications"> + created_at?: Prisma.DateTimeFilter<"Notifications"> | Date | string + viewed_at?: Prisma.DateTimeNullableFilter<"Notifications"> | Date | string | null + user?: Prisma.XOR +} + +export type NotificationsOrderByWithRelationInput = { + id?: Prisma.SortOrder + user_id?: Prisma.SortOrder + affected_module?: Prisma.SortOrder + subject?: Prisma.SortOrder + description?: Prisma.SortOrder + metadata?: Prisma.SortOrder + created_at?: Prisma.SortOrder + viewed_at?: Prisma.SortOrderInput | Prisma.SortOrder + user?: Prisma.UsersOrderByWithRelationInput +} + +export type NotificationsWhereUniqueInput = Prisma.AtLeast<{ + id?: number + user_id?: string + AND?: Prisma.NotificationsWhereInput | Prisma.NotificationsWhereInput[] + OR?: Prisma.NotificationsWhereInput[] + NOT?: Prisma.NotificationsWhereInput | Prisma.NotificationsWhereInput[] + affected_module?: Prisma.EnumModulesFilter<"Notifications"> | $Enums.Modules + subject?: Prisma.StringFilter<"Notifications"> | string + description?: Prisma.StringFilter<"Notifications"> | string + metadata?: Prisma.JsonFilter<"Notifications"> + created_at?: Prisma.DateTimeFilter<"Notifications"> | Date | string + viewed_at?: Prisma.DateTimeNullableFilter<"Notifications"> | Date | string | null + user?: Prisma.XOR +}, "id" | "user_id"> + +export type NotificationsOrderByWithAggregationInput = { + id?: Prisma.SortOrder + user_id?: Prisma.SortOrder + affected_module?: Prisma.SortOrder + subject?: Prisma.SortOrder + description?: Prisma.SortOrder + metadata?: Prisma.SortOrder + created_at?: Prisma.SortOrder + viewed_at?: Prisma.SortOrderInput | Prisma.SortOrder + _count?: Prisma.NotificationsCountOrderByAggregateInput + _avg?: Prisma.NotificationsAvgOrderByAggregateInput + _max?: Prisma.NotificationsMaxOrderByAggregateInput + _min?: Prisma.NotificationsMinOrderByAggregateInput + _sum?: Prisma.NotificationsSumOrderByAggregateInput +} + +export type NotificationsScalarWhereWithAggregatesInput = { + AND?: Prisma.NotificationsScalarWhereWithAggregatesInput | Prisma.NotificationsScalarWhereWithAggregatesInput[] + OR?: Prisma.NotificationsScalarWhereWithAggregatesInput[] + NOT?: Prisma.NotificationsScalarWhereWithAggregatesInput | Prisma.NotificationsScalarWhereWithAggregatesInput[] + id?: Prisma.IntWithAggregatesFilter<"Notifications"> | number + user_id?: Prisma.UuidWithAggregatesFilter<"Notifications"> | string + affected_module?: Prisma.EnumModulesWithAggregatesFilter<"Notifications"> | $Enums.Modules + subject?: Prisma.StringWithAggregatesFilter<"Notifications"> | string + description?: Prisma.StringWithAggregatesFilter<"Notifications"> | string + metadata?: Prisma.JsonWithAggregatesFilter<"Notifications"> + created_at?: Prisma.DateTimeWithAggregatesFilter<"Notifications"> | Date | string + viewed_at?: Prisma.DateTimeNullableWithAggregatesFilter<"Notifications"> | Date | string | null +} + +export type NotificationsCreateInput = { + affected_module: $Enums.Modules + subject: string + description: string + metadata: Prisma.JsonNullValueInput | runtime.InputJsonValue + created_at?: Date | string + viewed_at?: Date | string | null + user: Prisma.UsersCreateNestedOneWithoutNotificationsInput +} + +export type NotificationsUncheckedCreateInput = { + id?: number + user_id: string + affected_module: $Enums.Modules + subject: string + description: string + metadata: Prisma.JsonNullValueInput | runtime.InputJsonValue + created_at?: Date | string + viewed_at?: Date | string | null +} + +export type NotificationsUpdateInput = { + affected_module?: Prisma.EnumModulesFieldUpdateOperationsInput | $Enums.Modules + subject?: Prisma.StringFieldUpdateOperationsInput | string + description?: Prisma.StringFieldUpdateOperationsInput | string + metadata?: Prisma.JsonNullValueInput | runtime.InputJsonValue + created_at?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string + viewed_at?: Prisma.NullableDateTimeFieldUpdateOperationsInput | Date | string | null + user?: Prisma.UsersUpdateOneRequiredWithoutNotificationsNestedInput +} + +export type NotificationsUncheckedUpdateInput = { + id?: Prisma.IntFieldUpdateOperationsInput | number + user_id?: Prisma.StringFieldUpdateOperationsInput | string + affected_module?: Prisma.EnumModulesFieldUpdateOperationsInput | $Enums.Modules + subject?: Prisma.StringFieldUpdateOperationsInput | string + description?: Prisma.StringFieldUpdateOperationsInput | string + metadata?: Prisma.JsonNullValueInput | runtime.InputJsonValue + created_at?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string + viewed_at?: Prisma.NullableDateTimeFieldUpdateOperationsInput | Date | string | null +} + +export type NotificationsCreateManyInput = { + id?: number + user_id: string + affected_module: $Enums.Modules + subject: string + description: string + metadata: Prisma.JsonNullValueInput | runtime.InputJsonValue + created_at?: Date | string + viewed_at?: Date | string | null +} + +export type NotificationsUpdateManyMutationInput = { + affected_module?: Prisma.EnumModulesFieldUpdateOperationsInput | $Enums.Modules + subject?: Prisma.StringFieldUpdateOperationsInput | string + description?: Prisma.StringFieldUpdateOperationsInput | string + metadata?: Prisma.JsonNullValueInput | runtime.InputJsonValue + created_at?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string + viewed_at?: Prisma.NullableDateTimeFieldUpdateOperationsInput | Date | string | null +} + +export type NotificationsUncheckedUpdateManyInput = { + id?: Prisma.IntFieldUpdateOperationsInput | number + user_id?: Prisma.StringFieldUpdateOperationsInput | string + affected_module?: Prisma.EnumModulesFieldUpdateOperationsInput | $Enums.Modules + subject?: Prisma.StringFieldUpdateOperationsInput | string + description?: Prisma.StringFieldUpdateOperationsInput | string + metadata?: Prisma.JsonNullValueInput | runtime.InputJsonValue + created_at?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string + viewed_at?: Prisma.NullableDateTimeFieldUpdateOperationsInput | Date | string | null +} + +export type NotificationsNullableScalarRelationFilter = { + is?: Prisma.NotificationsWhereInput | null + isNot?: Prisma.NotificationsWhereInput | null +} + +export type NotificationsCountOrderByAggregateInput = { + id?: Prisma.SortOrder + user_id?: Prisma.SortOrder + affected_module?: Prisma.SortOrder + subject?: Prisma.SortOrder + description?: Prisma.SortOrder + metadata?: Prisma.SortOrder + created_at?: Prisma.SortOrder + viewed_at?: Prisma.SortOrder +} + +export type NotificationsAvgOrderByAggregateInput = { + id?: Prisma.SortOrder +} + +export type NotificationsMaxOrderByAggregateInput = { + id?: Prisma.SortOrder + user_id?: Prisma.SortOrder + affected_module?: Prisma.SortOrder + subject?: Prisma.SortOrder + description?: Prisma.SortOrder + created_at?: Prisma.SortOrder + viewed_at?: Prisma.SortOrder +} + +export type NotificationsMinOrderByAggregateInput = { + id?: Prisma.SortOrder + user_id?: Prisma.SortOrder + affected_module?: Prisma.SortOrder + subject?: Prisma.SortOrder + description?: Prisma.SortOrder + created_at?: Prisma.SortOrder + viewed_at?: Prisma.SortOrder +} + +export type NotificationsSumOrderByAggregateInput = { + id?: Prisma.SortOrder +} + +export type NotificationsCreateNestedOneWithoutUserInput = { + create?: Prisma.XOR + connectOrCreate?: Prisma.NotificationsCreateOrConnectWithoutUserInput + connect?: Prisma.NotificationsWhereUniqueInput +} + +export type NotificationsUncheckedCreateNestedOneWithoutUserInput = { + create?: Prisma.XOR + connectOrCreate?: Prisma.NotificationsCreateOrConnectWithoutUserInput + connect?: Prisma.NotificationsWhereUniqueInput +} + +export type NotificationsUpdateOneWithoutUserNestedInput = { + create?: Prisma.XOR + connectOrCreate?: Prisma.NotificationsCreateOrConnectWithoutUserInput + upsert?: Prisma.NotificationsUpsertWithoutUserInput + disconnect?: Prisma.NotificationsWhereInput | boolean + delete?: Prisma.NotificationsWhereInput | boolean + connect?: Prisma.NotificationsWhereUniqueInput + update?: Prisma.XOR, Prisma.NotificationsUncheckedUpdateWithoutUserInput> +} + +export type NotificationsUncheckedUpdateOneWithoutUserNestedInput = { + create?: Prisma.XOR + connectOrCreate?: Prisma.NotificationsCreateOrConnectWithoutUserInput + upsert?: Prisma.NotificationsUpsertWithoutUserInput + disconnect?: Prisma.NotificationsWhereInput | boolean + delete?: Prisma.NotificationsWhereInput | boolean + connect?: Prisma.NotificationsWhereUniqueInput + update?: Prisma.XOR, Prisma.NotificationsUncheckedUpdateWithoutUserInput> +} + +export type EnumModulesFieldUpdateOperationsInput = { + set?: $Enums.Modules +} + +export type DateTimeFieldUpdateOperationsInput = { + set?: Date | string +} + +export type NullableDateTimeFieldUpdateOperationsInput = { + set?: Date | string | null +} + +export type IntFieldUpdateOperationsInput = { + set?: number + increment?: number + decrement?: number + multiply?: number + divide?: number +} + +export type NotificationsCreateWithoutUserInput = { + affected_module: $Enums.Modules + subject: string + description: string + metadata: Prisma.JsonNullValueInput | runtime.InputJsonValue + created_at?: Date | string + viewed_at?: Date | string | null +} + +export type NotificationsUncheckedCreateWithoutUserInput = { + id?: number + affected_module: $Enums.Modules + subject: string + description: string + metadata: Prisma.JsonNullValueInput | runtime.InputJsonValue + created_at?: Date | string + viewed_at?: Date | string | null +} + +export type NotificationsCreateOrConnectWithoutUserInput = { + where: Prisma.NotificationsWhereUniqueInput + create: Prisma.XOR +} + +export type NotificationsUpsertWithoutUserInput = { + update: Prisma.XOR + create: Prisma.XOR + where?: Prisma.NotificationsWhereInput +} + +export type NotificationsUpdateToOneWithWhereWithoutUserInput = { + where?: Prisma.NotificationsWhereInput + data: Prisma.XOR +} + +export type NotificationsUpdateWithoutUserInput = { + affected_module?: Prisma.EnumModulesFieldUpdateOperationsInput | $Enums.Modules + subject?: Prisma.StringFieldUpdateOperationsInput | string + description?: Prisma.StringFieldUpdateOperationsInput | string + metadata?: Prisma.JsonNullValueInput | runtime.InputJsonValue + created_at?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string + viewed_at?: Prisma.NullableDateTimeFieldUpdateOperationsInput | Date | string | null +} + +export type NotificationsUncheckedUpdateWithoutUserInput = { + id?: Prisma.IntFieldUpdateOperationsInput | number + affected_module?: Prisma.EnumModulesFieldUpdateOperationsInput | $Enums.Modules + subject?: Prisma.StringFieldUpdateOperationsInput | string + description?: Prisma.StringFieldUpdateOperationsInput | string + metadata?: Prisma.JsonNullValueInput | runtime.InputJsonValue + created_at?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string + viewed_at?: Prisma.NullableDateTimeFieldUpdateOperationsInput | Date | string | null +} + + + +export type NotificationsSelect = runtime.Types.Extensions.GetSelect<{ + id?: boolean + user_id?: boolean + affected_module?: boolean + subject?: boolean + description?: boolean + metadata?: boolean + created_at?: boolean + viewed_at?: boolean + user?: boolean | Prisma.UsersDefaultArgs +}, ExtArgs["result"]["notifications"]> + +export type NotificationsSelectCreateManyAndReturn = runtime.Types.Extensions.GetSelect<{ + id?: boolean + user_id?: boolean + affected_module?: boolean + subject?: boolean + description?: boolean + metadata?: boolean + created_at?: boolean + viewed_at?: boolean + user?: boolean | Prisma.UsersDefaultArgs +}, ExtArgs["result"]["notifications"]> + +export type NotificationsSelectUpdateManyAndReturn = runtime.Types.Extensions.GetSelect<{ + id?: boolean + user_id?: boolean + affected_module?: boolean + subject?: boolean + description?: boolean + metadata?: boolean + created_at?: boolean + viewed_at?: boolean + user?: boolean | Prisma.UsersDefaultArgs +}, ExtArgs["result"]["notifications"]> + +export type NotificationsSelectScalar = { + id?: boolean + user_id?: boolean + affected_module?: boolean + subject?: boolean + description?: boolean + metadata?: boolean + created_at?: boolean + viewed_at?: boolean +} + +export type NotificationsOmit = runtime.Types.Extensions.GetOmit<"id" | "user_id" | "affected_module" | "subject" | "description" | "metadata" | "created_at" | "viewed_at", ExtArgs["result"]["notifications"]> +export type NotificationsInclude = { + user?: boolean | Prisma.UsersDefaultArgs +} +export type NotificationsIncludeCreateManyAndReturn = { + user?: boolean | Prisma.UsersDefaultArgs +} +export type NotificationsIncludeUpdateManyAndReturn = { + user?: boolean | Prisma.UsersDefaultArgs +} + +export type $NotificationsPayload = { + name: "Notifications" + objects: { + user: Prisma.$UsersPayload + } + scalars: runtime.Types.Extensions.GetPayloadResult<{ + id: number + user_id: string + affected_module: $Enums.Modules + subject: string + description: string + metadata: runtime.JsonValue + created_at: Date + viewed_at: Date | null + }, ExtArgs["result"]["notifications"]> + composites: {} +} + +export type NotificationsGetPayload = runtime.Types.Result.GetResult + +export type NotificationsCountArgs = + Omit & { + select?: NotificationsCountAggregateInputType | true + } + +export interface NotificationsDelegate { + [K: symbol]: { types: Prisma.TypeMap['model']['Notifications'], meta: { name: 'Notifications' } } + /** + * Find zero or one Notifications that matches the filter. + * @param {NotificationsFindUniqueArgs} args - Arguments to find a Notifications + * @example + * // Get one Notifications + * const notifications = await prisma.notifications.findUnique({ + * where: { + * // ... provide filter here + * } + * }) + */ + findUnique(args: Prisma.SelectSubset>): Prisma.Prisma__NotificationsClient, T, "findUnique", GlobalOmitOptions> | null, null, ExtArgs, GlobalOmitOptions> + + /** + * Find one Notifications that matches the filter or throw an error with `error.code='P2025'` + * if no matches were found. + * @param {NotificationsFindUniqueOrThrowArgs} args - Arguments to find a Notifications + * @example + * // Get one Notifications + * const notifications = await prisma.notifications.findUniqueOrThrow({ + * where: { + * // ... provide filter here + * } + * }) + */ + findUniqueOrThrow(args: Prisma.SelectSubset>): Prisma.Prisma__NotificationsClient, T, "findUniqueOrThrow", GlobalOmitOptions>, never, ExtArgs, GlobalOmitOptions> + + /** + * Find the first Notifications that matches the filter. + * Note, that providing `undefined` is treated as the value not being there. + * Read more here: https://pris.ly/d/null-undefined + * @param {NotificationsFindFirstArgs} args - Arguments to find a Notifications + * @example + * // Get one Notifications + * const notifications = await prisma.notifications.findFirst({ + * where: { + * // ... provide filter here + * } + * }) + */ + findFirst(args?: Prisma.SelectSubset>): Prisma.Prisma__NotificationsClient, T, "findFirst", GlobalOmitOptions> | null, null, ExtArgs, GlobalOmitOptions> + + /** + * Find the first Notifications that matches the filter or + * throw `PrismaKnownClientError` with `P2025` code if no matches were found. + * Note, that providing `undefined` is treated as the value not being there. + * Read more here: https://pris.ly/d/null-undefined + * @param {NotificationsFindFirstOrThrowArgs} args - Arguments to find a Notifications + * @example + * // Get one Notifications + * const notifications = await prisma.notifications.findFirstOrThrow({ + * where: { + * // ... provide filter here + * } + * }) + */ + findFirstOrThrow(args?: Prisma.SelectSubset>): Prisma.Prisma__NotificationsClient, T, "findFirstOrThrow", GlobalOmitOptions>, never, ExtArgs, GlobalOmitOptions> + + /** + * Find zero or more Notifications that matches the filter. + * Note, that providing `undefined` is treated as the value not being there. + * Read more here: https://pris.ly/d/null-undefined + * @param {NotificationsFindManyArgs} args - Arguments to filter and select certain fields only. + * @example + * // Get all Notifications + * const notifications = await prisma.notifications.findMany() + * + * // Get first 10 Notifications + * const notifications = await prisma.notifications.findMany({ take: 10 }) + * + * // Only select the `id` + * const notificationsWithIdOnly = await prisma.notifications.findMany({ select: { id: true } }) + * + */ + findMany(args?: Prisma.SelectSubset>): Prisma.PrismaPromise, T, "findMany", GlobalOmitOptions>> + + /** + * Create a Notifications. + * @param {NotificationsCreateArgs} args - Arguments to create a Notifications. + * @example + * // Create one Notifications + * const Notifications = await prisma.notifications.create({ + * data: { + * // ... data to create a Notifications + * } + * }) + * + */ + create(args: Prisma.SelectSubset>): Prisma.Prisma__NotificationsClient, T, "create", GlobalOmitOptions>, never, ExtArgs, GlobalOmitOptions> + + /** + * Create many Notifications. + * @param {NotificationsCreateManyArgs} args - Arguments to create many Notifications. + * @example + * // Create many Notifications + * const notifications = await prisma.notifications.createMany({ + * data: [ + * // ... provide data here + * ] + * }) + * + */ + createMany(args?: Prisma.SelectSubset>): Prisma.PrismaPromise + + /** + * Create many Notifications and returns the data saved in the database. + * @param {NotificationsCreateManyAndReturnArgs} args - Arguments to create many Notifications. + * @example + * // Create many Notifications + * const notifications = await prisma.notifications.createManyAndReturn({ + * data: [ + * // ... provide data here + * ] + * }) + * + * // Create many Notifications and only return the `id` + * const notificationsWithIdOnly = await prisma.notifications.createManyAndReturn({ + * select: { id: true }, + * data: [ + * // ... provide data here + * ] + * }) + * Note, that providing `undefined` is treated as the value not being there. + * Read more here: https://pris.ly/d/null-undefined + * + */ + createManyAndReturn(args?: Prisma.SelectSubset>): Prisma.PrismaPromise, T, "createManyAndReturn", GlobalOmitOptions>> + + /** + * Delete a Notifications. + * @param {NotificationsDeleteArgs} args - Arguments to delete one Notifications. + * @example + * // Delete one Notifications + * const Notifications = await prisma.notifications.delete({ + * where: { + * // ... filter to delete one Notifications + * } + * }) + * + */ + delete(args: Prisma.SelectSubset>): Prisma.Prisma__NotificationsClient, T, "delete", GlobalOmitOptions>, never, ExtArgs, GlobalOmitOptions> + + /** + * Update one Notifications. + * @param {NotificationsUpdateArgs} args - Arguments to update one Notifications. + * @example + * // Update one Notifications + * const notifications = await prisma.notifications.update({ + * where: { + * // ... provide filter here + * }, + * data: { + * // ... provide data here + * } + * }) + * + */ + update(args: Prisma.SelectSubset>): Prisma.Prisma__NotificationsClient, T, "update", GlobalOmitOptions>, never, ExtArgs, GlobalOmitOptions> + + /** + * Delete zero or more Notifications. + * @param {NotificationsDeleteManyArgs} args - Arguments to filter Notifications to delete. + * @example + * // Delete a few Notifications + * const { count } = await prisma.notifications.deleteMany({ + * where: { + * // ... provide filter here + * } + * }) + * + */ + deleteMany(args?: Prisma.SelectSubset>): Prisma.PrismaPromise + + /** + * Update zero or more Notifications. + * Note, that providing `undefined` is treated as the value not being there. + * Read more here: https://pris.ly/d/null-undefined + * @param {NotificationsUpdateManyArgs} args - Arguments to update one or more rows. + * @example + * // Update many Notifications + * const notifications = await prisma.notifications.updateMany({ + * where: { + * // ... provide filter here + * }, + * data: { + * // ... provide data here + * } + * }) + * + */ + updateMany(args: Prisma.SelectSubset>): Prisma.PrismaPromise + + /** + * Update zero or more Notifications and returns the data updated in the database. + * @param {NotificationsUpdateManyAndReturnArgs} args - Arguments to update many Notifications. + * @example + * // Update many Notifications + * const notifications = await prisma.notifications.updateManyAndReturn({ + * where: { + * // ... provide filter here + * }, + * data: [ + * // ... provide data here + * ] + * }) + * + * // Update zero or more Notifications and only return the `id` + * const notificationsWithIdOnly = await prisma.notifications.updateManyAndReturn({ + * select: { id: true }, + * where: { + * // ... provide filter here + * }, + * data: [ + * // ... provide data here + * ] + * }) + * Note, that providing `undefined` is treated as the value not being there. + * Read more here: https://pris.ly/d/null-undefined + * + */ + updateManyAndReturn(args: Prisma.SelectSubset>): Prisma.PrismaPromise, T, "updateManyAndReturn", GlobalOmitOptions>> + + /** + * Create or update one Notifications. + * @param {NotificationsUpsertArgs} args - Arguments to update or create a Notifications. + * @example + * // Update or create a Notifications + * const notifications = await prisma.notifications.upsert({ + * create: { + * // ... data to create a Notifications + * }, + * update: { + * // ... in case it already exists, update + * }, + * where: { + * // ... the filter for the Notifications we want to update + * } + * }) + */ + upsert(args: Prisma.SelectSubset>): Prisma.Prisma__NotificationsClient, T, "upsert", GlobalOmitOptions>, never, ExtArgs, GlobalOmitOptions> + + + /** + * Count the number of Notifications. + * Note, that providing `undefined` is treated as the value not being there. + * Read more here: https://pris.ly/d/null-undefined + * @param {NotificationsCountArgs} args - Arguments to filter Notifications to count. + * @example + * // Count the number of Notifications + * const count = await prisma.notifications.count({ + * where: { + * // ... the filter for the Notifications we want to count + * } + * }) + **/ + count( + args?: Prisma.Subset, + ): Prisma.PrismaPromise< + T extends runtime.Types.Utils.Record<'select', any> + ? T['select'] extends true + ? number + : Prisma.GetScalarType + : number + > + + /** + * Allows you to perform aggregations operations on a Notifications. + * Note, that providing `undefined` is treated as the value not being there. + * Read more here: https://pris.ly/d/null-undefined + * @param {NotificationsAggregateArgs} args - Select which aggregations you would like to apply and on what fields. + * @example + * // Ordered by age ascending + * // Where email contains prisma.io + * // Limited to the 10 users + * const aggregations = await prisma.user.aggregate({ + * _avg: { + * age: true, + * }, + * where: { + * email: { + * contains: "prisma.io", + * }, + * }, + * orderBy: { + * age: "asc", + * }, + * take: 10, + * }) + **/ + aggregate(args: Prisma.Subset): Prisma.PrismaPromise> + + /** + * Group by Notifications. + * Note, that providing `undefined` is treated as the value not being there. + * Read more here: https://pris.ly/d/null-undefined + * @param {NotificationsGroupByArgs} args - Group by arguments. + * @example + * // Group by city, order by createdAt, get count + * const result = await prisma.user.groupBy({ + * by: ['city', 'createdAt'], + * orderBy: { + * createdAt: true + * }, + * _count: { + * _all: true + * }, + * }) + * + **/ + groupBy< + T extends NotificationsGroupByArgs, + HasSelectOrTake extends Prisma.Or< + Prisma.Extends<'skip', Prisma.Keys>, + Prisma.Extends<'take', Prisma.Keys> + >, + OrderByArg extends Prisma.True extends HasSelectOrTake + ? { orderBy: NotificationsGroupByArgs['orderBy'] } + : { orderBy?: NotificationsGroupByArgs['orderBy'] }, + OrderFields extends Prisma.ExcludeUnderscoreKeys>>, + ByFields extends Prisma.MaybeTupleToUnion, + ByValid extends Prisma.Has, + HavingFields extends Prisma.GetHavingFields, + HavingValid extends Prisma.Has, + ByEmpty extends T['by'] extends never[] ? Prisma.True : Prisma.False, + InputErrors extends ByEmpty extends Prisma.True + ? `Error: "by" must not be empty.` + : HavingValid extends Prisma.False + ? { + [P in HavingFields]: P extends ByFields + ? never + : P extends string + ? `Error: Field "${P}" used in "having" needs to be provided in "by".` + : [ + Error, + 'Field ', + P, + ` in "having" needs to be provided in "by"`, + ] + }[HavingFields] + : 'take' extends Prisma.Keys + ? 'orderBy' extends Prisma.Keys + ? ByValid extends Prisma.True + ? {} + : { + [P in OrderFields]: P extends ByFields + ? never + : `Error: Field "${P}" in "orderBy" needs to be provided in "by"` + }[OrderFields] + : 'Error: If you provide "take", you also need to provide "orderBy"' + : 'skip' extends Prisma.Keys + ? 'orderBy' extends Prisma.Keys + ? ByValid extends Prisma.True + ? {} + : { + [P in OrderFields]: P extends ByFields + ? never + : `Error: Field "${P}" in "orderBy" needs to be provided in "by"` + }[OrderFields] + : 'Error: If you provide "skip", you also need to provide "orderBy"' + : ByValid extends Prisma.True + ? {} + : { + [P in OrderFields]: P extends ByFields + ? never + : `Error: Field "${P}" in "orderBy" needs to be provided in "by"` + }[OrderFields] + >(args: Prisma.SubsetIntersection & InputErrors): {} extends InputErrors ? GetNotificationsGroupByPayload : Prisma.PrismaPromise +/** + * Fields of the Notifications model + */ +readonly fields: NotificationsFieldRefs; +} + +/** + * The delegate class that acts as a "Promise-like" for Notifications. + * Why is this prefixed with `Prisma__`? + * Because we want to prevent naming conflicts as mentioned in + * https://github.com/prisma/prisma-client-js/issues/707 + */ +export interface Prisma__NotificationsClient extends Prisma.PrismaPromise { + readonly [Symbol.toStringTag]: "PrismaPromise" + user = {}>(args?: Prisma.Subset>): Prisma.Prisma__UsersClient, T, "findUniqueOrThrow", GlobalOmitOptions> | Null, Null, ExtArgs, GlobalOmitOptions> + /** + * Attaches callbacks for the resolution and/or rejection of the Promise. + * @param onfulfilled The callback to execute when the Promise is resolved. + * @param onrejected The callback to execute when the Promise is rejected. + * @returns A Promise for the completion of which ever callback is executed. + */ + then(onfulfilled?: ((value: T) => TResult1 | PromiseLike) | undefined | null, onrejected?: ((reason: any) => TResult2 | PromiseLike) | undefined | null): runtime.Types.Utils.JsPromise + /** + * Attaches a callback for only the rejection of the Promise. + * @param onrejected The callback to execute when the Promise is rejected. + * @returns A Promise for the completion of the callback. + */ + catch(onrejected?: ((reason: any) => TResult | PromiseLike) | undefined | null): runtime.Types.Utils.JsPromise + /** + * Attaches a callback that is invoked when the Promise is settled (fulfilled or rejected). The + * resolved value cannot be modified from the callback. + * @param onfinally The callback to execute when the Promise is settled (fulfilled or rejected). + * @returns A Promise for the completion of the callback. + */ + finally(onfinally?: (() => void) | undefined | null): runtime.Types.Utils.JsPromise +} + + + + +/** + * Fields of the Notifications model + */ +export interface NotificationsFieldRefs { + readonly id: Prisma.FieldRef<"Notifications", 'Int'> + readonly user_id: Prisma.FieldRef<"Notifications", 'String'> + readonly affected_module: Prisma.FieldRef<"Notifications", 'Modules'> + readonly subject: Prisma.FieldRef<"Notifications", 'String'> + readonly description: Prisma.FieldRef<"Notifications", 'String'> + readonly metadata: Prisma.FieldRef<"Notifications", 'Json'> + readonly created_at: Prisma.FieldRef<"Notifications", 'DateTime'> + readonly viewed_at: Prisma.FieldRef<"Notifications", 'DateTime'> +} + + +// Custom InputTypes +/** + * Notifications findUnique + */ +export type NotificationsFindUniqueArgs = { + /** + * Select specific fields to fetch from the Notifications + */ + select?: Prisma.NotificationsSelect | null + /** + * Omit specific fields from the Notifications + */ + omit?: Prisma.NotificationsOmit | null + /** + * Choose, which related nodes to fetch as well + */ + include?: Prisma.NotificationsInclude | null + /** + * Filter, which Notifications to fetch. + */ + where: Prisma.NotificationsWhereUniqueInput +} + +/** + * Notifications findUniqueOrThrow + */ +export type NotificationsFindUniqueOrThrowArgs = { + /** + * Select specific fields to fetch from the Notifications + */ + select?: Prisma.NotificationsSelect | null + /** + * Omit specific fields from the Notifications + */ + omit?: Prisma.NotificationsOmit | null + /** + * Choose, which related nodes to fetch as well + */ + include?: Prisma.NotificationsInclude | null + /** + * Filter, which Notifications to fetch. + */ + where: Prisma.NotificationsWhereUniqueInput +} + +/** + * Notifications findFirst + */ +export type NotificationsFindFirstArgs = { + /** + * Select specific fields to fetch from the Notifications + */ + select?: Prisma.NotificationsSelect | null + /** + * Omit specific fields from the Notifications + */ + omit?: Prisma.NotificationsOmit | null + /** + * Choose, which related nodes to fetch as well + */ + include?: Prisma.NotificationsInclude | null + /** + * Filter, which Notifications to fetch. + */ + where?: Prisma.NotificationsWhereInput + /** + * {@link https://www.prisma.io/docs/concepts/components/prisma-client/sorting Sorting Docs} + * + * Determine the order of Notifications to fetch. + */ + orderBy?: Prisma.NotificationsOrderByWithRelationInput | Prisma.NotificationsOrderByWithRelationInput[] + /** + * {@link https://www.prisma.io/docs/concepts/components/prisma-client/pagination#cursor-based-pagination Cursor Docs} + * + * Sets the position for searching for Notifications. + */ + cursor?: Prisma.NotificationsWhereUniqueInput + /** + * {@link https://www.prisma.io/docs/concepts/components/prisma-client/pagination Pagination Docs} + * + * Take `±n` Notifications from the position of the cursor. + */ + take?: number + /** + * {@link https://www.prisma.io/docs/concepts/components/prisma-client/pagination Pagination Docs} + * + * Skip the first `n` Notifications. + */ + skip?: number + /** + * {@link https://www.prisma.io/docs/concepts/components/prisma-client/distinct Distinct Docs} + * + * Filter by unique combinations of Notifications. + */ + distinct?: Prisma.NotificationsScalarFieldEnum | Prisma.NotificationsScalarFieldEnum[] +} + +/** + * Notifications findFirstOrThrow + */ +export type NotificationsFindFirstOrThrowArgs = { + /** + * Select specific fields to fetch from the Notifications + */ + select?: Prisma.NotificationsSelect | null + /** + * Omit specific fields from the Notifications + */ + omit?: Prisma.NotificationsOmit | null + /** + * Choose, which related nodes to fetch as well + */ + include?: Prisma.NotificationsInclude | null + /** + * Filter, which Notifications to fetch. + */ + where?: Prisma.NotificationsWhereInput + /** + * {@link https://www.prisma.io/docs/concepts/components/prisma-client/sorting Sorting Docs} + * + * Determine the order of Notifications to fetch. + */ + orderBy?: Prisma.NotificationsOrderByWithRelationInput | Prisma.NotificationsOrderByWithRelationInput[] + /** + * {@link https://www.prisma.io/docs/concepts/components/prisma-client/pagination#cursor-based-pagination Cursor Docs} + * + * Sets the position for searching for Notifications. + */ + cursor?: Prisma.NotificationsWhereUniqueInput + /** + * {@link https://www.prisma.io/docs/concepts/components/prisma-client/pagination Pagination Docs} + * + * Take `±n` Notifications from the position of the cursor. + */ + take?: number + /** + * {@link https://www.prisma.io/docs/concepts/components/prisma-client/pagination Pagination Docs} + * + * Skip the first `n` Notifications. + */ + skip?: number + /** + * {@link https://www.prisma.io/docs/concepts/components/prisma-client/distinct Distinct Docs} + * + * Filter by unique combinations of Notifications. + */ + distinct?: Prisma.NotificationsScalarFieldEnum | Prisma.NotificationsScalarFieldEnum[] +} + +/** + * Notifications findMany + */ +export type NotificationsFindManyArgs = { + /** + * Select specific fields to fetch from the Notifications + */ + select?: Prisma.NotificationsSelect | null + /** + * Omit specific fields from the Notifications + */ + omit?: Prisma.NotificationsOmit | null + /** + * Choose, which related nodes to fetch as well + */ + include?: Prisma.NotificationsInclude | null + /** + * Filter, which Notifications to fetch. + */ + where?: Prisma.NotificationsWhereInput + /** + * {@link https://www.prisma.io/docs/concepts/components/prisma-client/sorting Sorting Docs} + * + * Determine the order of Notifications to fetch. + */ + orderBy?: Prisma.NotificationsOrderByWithRelationInput | Prisma.NotificationsOrderByWithRelationInput[] + /** + * {@link https://www.prisma.io/docs/concepts/components/prisma-client/pagination#cursor-based-pagination Cursor Docs} + * + * Sets the position for listing Notifications. + */ + cursor?: Prisma.NotificationsWhereUniqueInput + /** + * {@link https://www.prisma.io/docs/concepts/components/prisma-client/pagination Pagination Docs} + * + * Take `±n` Notifications from the position of the cursor. + */ + take?: number + /** + * {@link https://www.prisma.io/docs/concepts/components/prisma-client/pagination Pagination Docs} + * + * Skip the first `n` Notifications. + */ + skip?: number + distinct?: Prisma.NotificationsScalarFieldEnum | Prisma.NotificationsScalarFieldEnum[] +} + +/** + * Notifications create + */ +export type NotificationsCreateArgs = { + /** + * Select specific fields to fetch from the Notifications + */ + select?: Prisma.NotificationsSelect | null + /** + * Omit specific fields from the Notifications + */ + omit?: Prisma.NotificationsOmit | null + /** + * Choose, which related nodes to fetch as well + */ + include?: Prisma.NotificationsInclude | null + /** + * The data needed to create a Notifications. + */ + data: Prisma.XOR +} + +/** + * Notifications createMany + */ +export type NotificationsCreateManyArgs = { + /** + * The data used to create many Notifications. + */ + data: Prisma.NotificationsCreateManyInput | Prisma.NotificationsCreateManyInput[] + skipDuplicates?: boolean +} + +/** + * Notifications createManyAndReturn + */ +export type NotificationsCreateManyAndReturnArgs = { + /** + * Select specific fields to fetch from the Notifications + */ + select?: Prisma.NotificationsSelectCreateManyAndReturn | null + /** + * Omit specific fields from the Notifications + */ + omit?: Prisma.NotificationsOmit | null + /** + * The data used to create many Notifications. + */ + data: Prisma.NotificationsCreateManyInput | Prisma.NotificationsCreateManyInput[] + skipDuplicates?: boolean + /** + * Choose, which related nodes to fetch as well + */ + include?: Prisma.NotificationsIncludeCreateManyAndReturn | null +} + +/** + * Notifications update + */ +export type NotificationsUpdateArgs = { + /** + * Select specific fields to fetch from the Notifications + */ + select?: Prisma.NotificationsSelect | null + /** + * Omit specific fields from the Notifications + */ + omit?: Prisma.NotificationsOmit | null + /** + * Choose, which related nodes to fetch as well + */ + include?: Prisma.NotificationsInclude | null + /** + * The data needed to update a Notifications. + */ + data: Prisma.XOR + /** + * Choose, which Notifications to update. + */ + where: Prisma.NotificationsWhereUniqueInput +} + +/** + * Notifications updateMany + */ +export type NotificationsUpdateManyArgs = { + /** + * The data used to update Notifications. + */ + data: Prisma.XOR + /** + * Filter which Notifications to update + */ + where?: Prisma.NotificationsWhereInput + /** + * Limit how many Notifications to update. + */ + limit?: number +} + +/** + * Notifications updateManyAndReturn + */ +export type NotificationsUpdateManyAndReturnArgs = { + /** + * Select specific fields to fetch from the Notifications + */ + select?: Prisma.NotificationsSelectUpdateManyAndReturn | null + /** + * Omit specific fields from the Notifications + */ + omit?: Prisma.NotificationsOmit | null + /** + * The data used to update Notifications. + */ + data: Prisma.XOR + /** + * Filter which Notifications to update + */ + where?: Prisma.NotificationsWhereInput + /** + * Limit how many Notifications to update. + */ + limit?: number + /** + * Choose, which related nodes to fetch as well + */ + include?: Prisma.NotificationsIncludeUpdateManyAndReturn | null +} + +/** + * Notifications upsert + */ +export type NotificationsUpsertArgs = { + /** + * Select specific fields to fetch from the Notifications + */ + select?: Prisma.NotificationsSelect | null + /** + * Omit specific fields from the Notifications + */ + omit?: Prisma.NotificationsOmit | null + /** + * Choose, which related nodes to fetch as well + */ + include?: Prisma.NotificationsInclude | null + /** + * The filter to search for the Notifications to update in case it exists. + */ + where: Prisma.NotificationsWhereUniqueInput + /** + * In case the Notifications found by the `where` argument doesn't exist, create a new Notifications with this data. + */ + create: Prisma.XOR + /** + * In case the Notifications was found with the provided `where` argument, update it with this data. + */ + update: Prisma.XOR +} + +/** + * Notifications delete + */ +export type NotificationsDeleteArgs = { + /** + * Select specific fields to fetch from the Notifications + */ + select?: Prisma.NotificationsSelect | null + /** + * Omit specific fields from the Notifications + */ + omit?: Prisma.NotificationsOmit | null + /** + * Choose, which related nodes to fetch as well + */ + include?: Prisma.NotificationsInclude | null + /** + * Filter which Notifications to delete. + */ + where: Prisma.NotificationsWhereUniqueInput +} + +/** + * Notifications deleteMany + */ +export type NotificationsDeleteManyArgs = { + /** + * Filter which Notifications to delete + */ + where?: Prisma.NotificationsWhereInput + /** + * Limit how many Notifications to delete. + */ + limit?: number +} + +/** + * Notifications without action + */ +export type NotificationsDefaultArgs = { + /** + * Select specific fields to fetch from the Notifications + */ + select?: Prisma.NotificationsSelect | null + /** + * Omit specific fields from the Notifications + */ + omit?: Prisma.NotificationsOmit | null + /** + * Choose, which related nodes to fetch as well + */ + include?: Prisma.NotificationsInclude | null +} diff --git a/prisma/postgres/schema.prisma b/prisma/postgres/schema.prisma index bc44159..47dcfd0 100644 --- a/prisma/postgres/schema.prisma +++ b/prisma/postgres/schema.prisma @@ -88,9 +88,9 @@ model Contracts { employee_id Int @unique daily_expected_hours Int @default(24) applicable_overtime ApplicableOvertime[] @default([WEEKLY]) - phone_allocation Decimal @default(0.00) - on_call_allocation Decimal @default(0.00) - weekend_on_call_allocation Decimal @default(0.00) + phone_allocation Decimal @default(0.00) @db.Decimal(5, 2) + on_call_allocation Decimal @default(0.00) @db.Decimal(5, 2) + weekend_on_call_allocation Decimal @default(0.00) @db.Decimal(5, 2) employee Employees @relation("EmployeeContract", fields: [employee_id], references: [id]) diff --git a/src/identity-and-account/contract/contract.controller.ts b/src/identity-and-account/contract/contract.controller.ts index 74b2de4..8c9d02f 100644 --- a/src/identity-and-account/contract/contract.controller.ts +++ b/src/identity-and-account/contract/contract.controller.ts @@ -5,6 +5,7 @@ import { ContractService } from "src/identity-and-account/contract/services/cont export class ContractController { constructor(private readonly getService: ContractService) {} + } \ No newline at end of file diff --git a/src/identity-and-account/contract/contract.dto.ts b/src/identity-and-account/contract/contract.dto.ts index 6953641..75c1d3b 100644 --- a/src/identity-and-account/contract/contract.dto.ts +++ b/src/identity-and-account/contract/contract.dto.ts @@ -3,7 +3,6 @@ import { IsInt, IsString } from "class-validator"; import { ApplicableOvertime } from "prisma/postgres/generated/prisma/client/postgres/enums"; export class Contract { - @IsInt() employee_id: number; @IsInt() daily_expected_hours: number; @IsString() applicable_overtime: ApplicableOvertime; @Type(() => Number) phone_allocation: number; diff --git a/src/identity-and-account/employees/employee-detailed.dto.ts b/src/identity-and-account/employees/employee-detailed.dto.ts index d290285..1e3a564 100644 --- a/src/identity-and-account/employees/employee-detailed.dto.ts +++ b/src/identity-and-account/employees/employee-detailed.dto.ts @@ -2,6 +2,7 @@ import { IsArray, IsBoolean, IsDateString, IsEmail, IsInt, IsNotEmpty, IsOptiona import { Type } from 'class-transformer'; import { PaidTimeOffDto } from 'src/time-and-attendance/paid-time-off/paid-time-off.dto'; import { Prisma } from 'prisma/postgres/generated/prisma/client/postgres/client'; +import { Contract } from 'src/identity-and-account/contract/contract.dto'; export class EmployeeDetailedDto { @IsString() @IsNotEmpty() first_name: string; @@ -14,13 +15,13 @@ export class EmployeeDetailedDto { @IsEmail() @IsOptional() email: string; @IsString() phone_number: string; @IsDateString() first_work_day: string; - @IsInt() daily_expected_hours: number; @IsDateString() @IsOptional() last_work_day?: string | null; @IsString() @IsOptional() residence?: string; + @IsInt() @Type(() => Contract) contract: Partial; @IsOptional() @Type(() => PaidTimeOffDto) paid_time_off?: Partial; @IsInt() @IsPositive() @Type(() => Number) external_payroll_id: number; @IsArray() @IsString({ each: true }) user_module_access: string[]; - @IsInt() @IsOptional() preset_id?: number; + @IsInt() @IsOptional() preset_id?: number; } export class EmployeeDetailedUpsertDto { @@ -34,13 +35,13 @@ export class EmployeeDetailedUpsertDto { @IsEmail() @IsOptional() email: string; @IsString() phone_number: string; @IsDateString() first_work_day: string; - @IsInt() daily_expected_hours: number; @IsDateString() @IsOptional() last_work_day?: string | null; @IsString() @IsOptional() residence?: string; + @IsInt() @Type(() => Contract) contract: Partial; @IsOptional() @Type(() => PaidTimeOffDto) paid_time_off?: PaidTimeOffDto; @IsInt() @IsPositive() @Type(() => Number) external_payroll_id: number; @IsArray() @IsString({ each: true }) user_module_access: string[]; - @IsInt() @IsOptional() preset_id?: number; + @IsInt() @IsOptional() preset_id?: number; } @@ -74,9 +75,26 @@ export type EmployeeWithDetails = Prisma.EmployeesGetPayload<{ first_work_day: true, last_work_day: true, external_payroll_id: true, - paid_time_off: true, + paid_time_off: { + select: { + id: true, + employee_id: true, + sick_hours: true, + vacation_hours: true, + banked_hours: true, + last_updated: true, + }, + }, is_supervisor: true, - daily_expected_hours: true, + contracts: { + select: { + daily_expected_hours: true, + applicable_overtime: true, + weekend_on_call_allocation: true, + on_call_allocation: true, + phone_allocation: true, + }, + }, schedule_preset_id: true, schedule_preset: { select: { id: true } } } diff --git a/src/identity-and-account/employees/services/employees-create.service.ts b/src/identity-and-account/employees/services/employees-create.service.ts index 1454c30..b737b56 100644 --- a/src/identity-and-account/employees/services/employees-create.service.ts +++ b/src/identity-and-account/employees/services/employees-create.service.ts @@ -44,13 +44,20 @@ export class EmployeesCreateService { data: { user_id: user.id, external_payroll_id: dto.external_payroll_id, - daily_expected_hours: dto.daily_expected_hours, company_code: company_code, job_title: dto.job_title, first_work_day: first_work_day, is_supervisor: dto.is_supervisor, supervisor_id: supervisor_id, schedule_preset_id: dto.preset_id, + contracts: { + create: { + daily_expected_hours: dto.contract.daily_expected_hours, + phone_allocation: dto.contract.phone_allocation, + on_call_allocation: dto.contract.on_call_allocation, + weekend_on_call_allocation: dto.contract.weekend_on_call_allocation, + }, + }, }, }); }); diff --git a/src/identity-and-account/employees/services/employees-get.service.ts b/src/identity-and-account/employees/services/employees-get.service.ts index a8d1306..01890e2 100644 --- a/src/identity-and-account/employees/services/employees-get.service.ts +++ b/src/identity-and-account/employees/services/employees-get.service.ts @@ -37,8 +37,12 @@ export class EmployeesGetService { }, }, }, + contracts: { + select: { + daily_expected_hours: true, + }, + }, is_supervisor: true, - daily_expected_hours: true, job_title: true, company_code: true, external_payroll_id: true, @@ -47,23 +51,29 @@ export class EmployeesGetService { schedule_preset_id: true, } - }).then(rows => rows.map(r => ({ - first_name: r.user.first_name, - last_name: r.user.last_name, - email: r.user.email, - phone_number: r.user.phone_number, - company_name: toStringFromCompanyCode(r.company_code), - job_title: r.job_title ?? '', - daily_expected_hours: r.daily_expected_hours, - external_payroll_id: r.external_payroll_id, - employee_full_name: `${r.user.first_name} ${r.user.last_name}`, - is_supervisor: r.is_supervisor, - supervisor_full_name: `${r.supervisor?.user.first_name} ${r.supervisor?.user.last_name}`, - first_work_day: toStringFromDate(r.first_work_day), - last_work_day: r.last_work_day ? toStringFromDate(r.last_work_day) : null, - preset_id: r.schedule_preset_id ?? undefined, - }))); - return { success: true, data: employee_list }; + }); + + const employeeDetailedList = employee_list.map(r => { + return { + first_name: r.user.first_name, + last_name: r.user.last_name, + email: r.user.email, + phone_number: r.user.phone_number, + company_name: toStringFromCompanyCode(r.company_code), + job_title: r.job_title ?? '', + contract: { + daily_expected_hours: r.contracts?.daily_expected_hours ?? 24, + }, + external_payroll_id: r.external_payroll_id, + employee_full_name: `${r.user.first_name} ${r.user.last_name}`, + is_supervisor: r.is_supervisor, + supervisor_full_name: `${r.supervisor?.user.first_name} ${r.supervisor?.user.last_name}`, + first_work_day: toStringFromDate(r.first_work_day), + last_work_day: r.last_work_day ? toStringFromDate(r.last_work_day) : null, + preset_id: r.schedule_preset_id ?? undefined, + } + }); + return { success: true, data: employeeDetailedList }; }; async findOwnProfile(email: string): Promise, string>> { @@ -89,7 +99,11 @@ export class EmployeesGetService { paid_time_off: true, is_supervisor: true, schedule_preset_id: true, - daily_expected_hours: true, + contracts: { + select: { + daily_expected_hours: true, + }, + }, supervisor: { select: { id: true, user: { @@ -103,6 +117,7 @@ export class EmployeesGetService { }, }); if (!existing_profile) return { success: false, error: 'EMPLOYEE_NOT_FOUND' }; + if (!existing_profile.contracts) return { success: false, error: 'CONTRACT_NOT_FOUND' }; const company_name = toStringFromCompanyCode(existing_profile.company_code); @@ -113,7 +128,9 @@ export class EmployeesGetService { email: existing_profile.user.email, supervisor_full_name: `${existing_profile.supervisor?.user.first_name} ${existing_profile.supervisor?.user.last_name}`, company_name: company_name, - daily_expected_hours: existing_profile.daily_expected_hours, + contract: { + daily_expected_hours: existing_profile.contracts?.daily_expected_hours ?? 24, + }, job_title: existing_profile.job_title ?? '', external_payroll_id: existing_profile.external_payroll_id, paid_time_off: { @@ -170,6 +187,11 @@ export class EmployeesGetService { }, }, }, + contracts: { + select: { + daily_expected_hours: true, + } + }, job_title: true, company_code: true, first_work_day: true, @@ -177,7 +199,6 @@ export class EmployeesGetService { external_payroll_id: true, paid_time_off: true, is_supervisor: true, - daily_expected_hours: true, schedule_preset_id: true, schedule_preset: { select: { @@ -196,35 +217,36 @@ export class EmployeesGetService { const company_name = toStringFromCompanyCode(employee.company_code); - return { - success: true, - data: { - first_name: employee.user.first_name, - last_name: employee.user.last_name, - email: employee.user.email, - residence: employee.user.residence ?? '', - phone_number: employee.user.phone_number, - company_name: company_name, - is_supervisor: employee.is_supervisor ?? false, - job_title: employee.job_title ?? '', - external_payroll_id: employee.external_payroll_id, - paid_time_off: { - id: employee.paid_time_off?.id ?? -1, - employee_id: employee.paid_time_off?.employee_id ?? -1, - sick_hours: employee.paid_time_off?.sick_hours.toNumber() ?? 0, - vacation_hours: employee.paid_time_off?.vacation_hours.toNumber() ?? 0, - banked_hours: employee.paid_time_off?.banked_hours.toNumber() ?? 0, - last_updated: employee.paid_time_off?.last_updated?.toISOString() ?? null, - }, - employee_full_name: `${employee.user.first_name} ${employee.user.last_name}`, - first_work_day: toStringFromDate(employee.first_work_day), - last_work_day: employee.last_work_day ? toStringFromDate(employee.last_work_day) : undefined, - supervisor_full_name: employee.supervisor ? `${employee.supervisor?.user.first_name} ${employee.supervisor?.user.last_name}` : '', - user_module_access: module_access_array, - daily_expected_hours: employee.daily_expected_hours, - preset_id: employee.schedule_preset_id ? employee.schedule_preset_id : undefined, + const detailed_employee: EmployeeDetailedDto = { + first_name: employee.user.first_name, + last_name: employee.user.last_name, + email: employee.user.email, + residence: employee.user.residence ?? '', + phone_number: employee.user.phone_number, + company_name: company_name, + is_supervisor: employee.is_supervisor ?? false, + job_title: employee.job_title ?? '', + external_payroll_id: employee.external_payroll_id, + paid_time_off: { + id: employee.paid_time_off?.id ?? -1, + employee_id: employee.paid_time_off?.employee_id ?? -1, + sick_hours: employee.paid_time_off?.sick_hours.toNumber() ?? 0, + vacation_hours: employee.paid_time_off?.vacation_hours.toNumber() ?? 0, + banked_hours: employee.paid_time_off?.banked_hours.toNumber() ?? 0, + last_updated: employee.paid_time_off?.last_updated?.toISOString() ?? null, }, - }; + employee_full_name: `${employee.user.first_name} ${employee.user.last_name}`, + first_work_day: toStringFromDate(employee.first_work_day), + last_work_day: employee.last_work_day ? toStringFromDate(employee.last_work_day) : undefined, + supervisor_full_name: employee.supervisor ? `${employee.supervisor?.user.first_name} ${employee.supervisor?.user.last_name}` : '', + user_module_access: module_access_array, + contract: { + daily_expected_hours: employee.contracts?.daily_expected_hours ?? 24, + }, + preset_id: employee.schedule_preset_id ? employee.schedule_preset_id : undefined, + } + + return { success: true, data: detailed_employee }; }; } diff --git a/src/identity-and-account/employees/services/employees-update.service.ts b/src/identity-and-account/employees/services/employees-update.service.ts index 5a0df71..e1fce64 100644 --- a/src/identity-and-account/employees/services/employees-update.service.ts +++ b/src/identity-and-account/employees/services/employees-update.service.ts @@ -98,13 +98,20 @@ export class EmployeesUpdateService { data: { company_code: company_code, job_title: dto.job_title, - daily_expected_hours: dto.daily_expected_hours, first_work_day: toDateFromString(dto.first_work_day), last_work_day: last_work_day, is_supervisor: dto.is_supervisor, supervisor_id: supervisor_id, schedule_preset_id: dto.preset_id, external_payroll_id: dto.external_payroll_id, + contracts: { + update: { + daily_expected_hours: dto.contract.daily_expected_hours, + on_call_allocation: dto.contract.on_call_allocation, + weekend_on_call_allocation: dto.contract.weekend_on_call_allocation, + phone_allocation: dto.contract.phone_allocation, + }, + }, }, }); diff --git a/src/time-and-attendance/timesheets/services/timesheet-employee-overview.service.ts b/src/time-and-attendance/timesheets/services/timesheet-employee-overview.service.ts index 1a0b2d0..54ebdcb 100644 --- a/src/time-and-attendance/timesheets/services/timesheet-employee-overview.service.ts +++ b/src/time-and-attendance/timesheets/services/timesheet-employee-overview.service.ts @@ -1,4 +1,3 @@ - import { NUMBER_OF_TIMESHEETS_TO_RETURN } from "src/common/utils/constants.utils"; import { Injectable } from "@nestjs/common"; import { PrismaPostgresService } from "prisma/postgres/prisma-postgres.service"; @@ -16,9 +15,9 @@ export class GetTimesheetsOverviewService { ) { } async getTimesheetsForEmployeeByPeriod( - email: string, - pay_year: number, - pay_period_no: number, + email: string, + pay_year: number, + pay_period_no: number, employee_email?: string ): Promise> { try { @@ -56,16 +55,28 @@ export class GetTimesheetsOverviewService { //find user infos using the employee_id const employee = await this.prisma.employees.findUnique({ where: { id: employee_id.data }, - select: { daily_expected_hours: true, schedule_preset: true, user: true }, + select: { schedule_preset: true, user: true, id: true } }); - if (!employee) return { success: false, error: `EMPLOYEE_NOT_FOUND` } + if (!employee) return { success: false, error: `EMPLOYEE_NOT_FOUND` }; + if (!employee.user) return { success: false, error: 'USER_NOT_FOUND' }; + + const contractDetails = await this.prisma.contracts.findUnique({ + where: { employee_id: employee.id }, + select: { + daily_expected_hours: true, + applicable_overtime: true, + phone_allocation: true, + on_call_allocation: true, + weekend_on_call_allocation: true, + } + }); + if (!contractDetails) return { success: false, error: 'CONTRACT_NOT_FOUND' }; //builds employee details const has_preset_schedule = employee.schedule_preset !== null; const user = employee.user; const employee_fullname = `${user.first_name} ${user.last_name}`.trim(); - //maps all timesheet's infos const timesheets = await Promise.all(rows.map((timesheet) => mapOneTimesheet(timesheet))); if (!timesheets) return { success: false, error: 'INVALID_TIMESHEET' } @@ -73,7 +84,13 @@ export class GetTimesheetsOverviewService { const data: Timesheets = { has_preset_schedule, employee_fullname, - daily_expected_hours: employee.daily_expected_hours, + contract: { + daily_expected_hours: contractDetails.daily_expected_hours, + applicable_overtime: contractDetails.applicable_overtime, + phone_allocation: Number(contractDetails.phone_allocation), + on_call_allocation: Number(contractDetails.on_call_allocation), + weekend_on_call_allocation: Number(contractDetails.weekend_on_call_allocation), + }, timesheets, } @@ -85,8 +102,8 @@ export class GetTimesheetsOverviewService { } private async loadTimesheets( - employee_id: number, - period_start: Date, + employee_id: number, + period_start: Date, period_end: Date ) { return this.prisma.timesheets.findMany({ @@ -101,7 +118,7 @@ export class GetTimesheetsOverviewService { } private ensureTimesheet = async ( - employee_id: number, + employee_id: number, start_date: Date | string ) => { const start = toDateFromString(start_date); diff --git a/src/time-and-attendance/timesheets/timesheet.dto.ts b/src/time-and-attendance/timesheets/timesheet.dto.ts index 56e5acd..c0e407f 100644 --- a/src/time-and-attendance/timesheets/timesheet.dto.ts +++ b/src/time-and-attendance/timesheets/timesheet.dto.ts @@ -1,5 +1,5 @@ import { Type } from "class-transformer"; -import { IsBoolean, IsDate, IsInt, IsOptional, IsString } from "class-validator"; +import { IsArray, IsBoolean, IsDate, IsInt, IsOptional, IsString } from "class-validator"; export class TimesheetEntity { @IsInt() id: number; @@ -11,10 +11,19 @@ export class TimesheetEntity { export class Timesheets { @IsBoolean() has_preset_schedule: boolean; @IsString() employee_fullname: string; - @IsInt() daily_expected_hours: number; + @Type(() => Contract) contract: Contract; + @Type(() => Number) @Type(() => Timesheet) timesheets: Timesheet[]; } +export class Contract { + @Type(() => Number) daily_expected_hours: number; + @Type(() => Number) phone_allocation: number; + @Type(() => Number) on_call_allocation: number; + @Type(() => Number) weekend_on_call_allocation: number; + @IsArray() @IsString() applicable_overtime: string[]; +} + export class Timesheet { @IsInt() timesheet_id: number; @IsBoolean() is_approved: boolean;