fix(imports): ajusted imports to remove relative paths
This commit is contained in:
parent
2debd40871
commit
2b033de91b
|
|
@ -1,7 +1,8 @@
|
||||||
import { Body, Controller, Delete, Param, ParseIntPipe, Patch, Post } from "@nestjs/common";
|
import { Controller, Post, Param, ParseIntPipe, Body, Patch, Delete } from "@nestjs/common";
|
||||||
import { CreateResult, ExpenseUpsertService, UpdateResult } from "../services/expense-upsert.service";
|
import { CreateExpenseResult, UpdateExpenseResult } from "src/time-and-attendance/utils/type.utils";
|
||||||
|
import { ExpenseUpsertService } from "src/time-and-attendance/modules/expenses/services/expense-upsert.service";
|
||||||
import { updateExpenseDto } from "src/time-and-attendance/modules/expenses/dtos/expense-update.dto";
|
import { updateExpenseDto } from "src/time-and-attendance/modules/expenses/dtos/expense-update.dto";
|
||||||
import { ExpenseDto } from "../dtos/expense-create.dto";
|
import { ExpenseDto } from "src/time-and-attendance/modules/expenses/dtos/expense-create.dto";
|
||||||
|
|
||||||
|
|
||||||
@Controller('expense')
|
@Controller('expense')
|
||||||
|
|
@ -11,13 +12,13 @@ export class ExpenseController {
|
||||||
@Post(':timesheet_id')
|
@Post(':timesheet_id')
|
||||||
create(
|
create(
|
||||||
@Param('timesheet_id', ParseIntPipe) timesheet_id: number,
|
@Param('timesheet_id', ParseIntPipe) timesheet_id: number,
|
||||||
@Body() dto: ExpenseDto): Promise<CreateResult>{
|
@Body() dto: ExpenseDto): Promise<CreateExpenseResult>{
|
||||||
return this.upsert_service.createExpense(timesheet_id, dto);
|
return this.upsert_service.createExpense(timesheet_id, dto);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Patch()
|
@Patch()
|
||||||
update(
|
update(
|
||||||
@Body() body: { update :{ id: number; dto: updateExpenseDto }}): Promise<UpdateResult>{
|
@Body() body: { update :{ id: number; dto: updateExpenseDto }}): Promise<UpdateExpenseResult>{
|
||||||
return this.upsert_service.updateExpense(body.update);
|
return this.upsert_service.updateExpense(body.update);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
import { OmitType, PartialType } from "@nestjs/swagger";
|
import { OmitType, PartialType } from "@nestjs/swagger";
|
||||||
import { ExpenseDto } from "./expense-create.dto";
|
import { ExpenseDto } from "src/time-and-attendance/modules/expenses/dtos/expense-create.dto";
|
||||||
|
|
||||||
export class updateExpenseDto extends PartialType (
|
export class updateExpenseDto extends PartialType (
|
||||||
OmitType(ExpenseDto, ['is_approved', 'timesheet_id'] as const)
|
OmitType(ExpenseDto, ['is_approved', 'timesheet_id'] as const)
|
||||||
|
|
|
||||||
|
|
@ -1,18 +1,12 @@
|
||||||
|
|
||||||
|
import { CreateExpenseResult, UpdateExpensePayload, UpdateExpenseResult, DeleteExpenseResult, NormalizedExpense } from "src/time-and-attendance/utils/type.utils";
|
||||||
import { toDateFromString, toStringFromDate } from "src/time-and-attendance/utils/date-time.utils";
|
import { toDateFromString, toStringFromDate } from "src/time-and-attendance/utils/date-time.utils";
|
||||||
import { Injectable, NotFoundException } from "@nestjs/common";
|
import { Injectable, NotFoundException } from "@nestjs/common";
|
||||||
import { updateExpenseDto } from "../dtos/expense-update.dto";
|
import { expense_select } from "src/time-and-attendance/utils/selects.utils";
|
||||||
import { GetExpenseDto } from "../dtos/expense-get.dto";
|
|
||||||
import { PrismaService } from "src/prisma/prisma.service";
|
import { PrismaService } from "src/prisma/prisma.service";
|
||||||
import { ExpenseDto } from "../dtos/expense-create.dto";
|
import { GetExpenseDto } from "src/time-and-attendance/modules/expenses/dtos/expense-get.dto";
|
||||||
import { Prisma } from "@prisma/client";
|
import { ExpenseDto } from "src/time-and-attendance/modules/expenses/dtos/expense-create.dto";
|
||||||
|
|
||||||
type Normalized = { date: Date; comment: string; supervisor_comment?: string; };
|
|
||||||
|
|
||||||
export type CreateResult = { ok: true; data: GetExpenseDto } | { ok: false; error: any };
|
|
||||||
export type UpdatePayload = { id: number; dto: updateExpenseDto };
|
|
||||||
export type UpdateResult = { ok: true; id: number; data: GetExpenseDto } | { ok: false; id: number; error: any };
|
|
||||||
export type DeleteResult = { ok: true; id: number; } | { ok: false; id: number; error: any };
|
|
||||||
|
|
||||||
@Injectable()
|
@Injectable()
|
||||||
export class ExpenseUpsertService {
|
export class ExpenseUpsertService {
|
||||||
|
|
@ -21,7 +15,7 @@ export class ExpenseUpsertService {
|
||||||
//_________________________________________________________________
|
//_________________________________________________________________
|
||||||
// CREATE
|
// CREATE
|
||||||
//_________________________________________________________________
|
//_________________________________________________________________
|
||||||
async createExpense(timesheet_id: number, dto: ExpenseDto): Promise<CreateResult> {
|
async createExpense(timesheet_id: number, dto: ExpenseDto): Promise<CreateExpenseResult> {
|
||||||
try {
|
try {
|
||||||
//normalize strings and dates
|
//normalize strings and dates
|
||||||
const normed_expense = this.normalizeExpenseDto(dto);
|
const normed_expense = this.normalizeExpenseDto(dto);
|
||||||
|
|
@ -71,7 +65,7 @@ export class ExpenseUpsertService {
|
||||||
//_________________________________________________________________
|
//_________________________________________________________________
|
||||||
// UPDATE
|
// UPDATE
|
||||||
//_________________________________________________________________
|
//_________________________________________________________________
|
||||||
async updateExpense({id, dto}: UpdatePayload): Promise<UpdateResult> {
|
async updateExpense({id, dto}: UpdateExpensePayload): Promise<UpdateExpenseResult> {
|
||||||
try {
|
try {
|
||||||
//checks for modifications
|
//checks for modifications
|
||||||
const data: Record<string, unknown> = {};
|
const data: Record<string, unknown> = {};
|
||||||
|
|
@ -117,7 +111,7 @@ export class ExpenseUpsertService {
|
||||||
//_________________________________________________________________
|
//_________________________________________________________________
|
||||||
// DELETE
|
// DELETE
|
||||||
//_________________________________________________________________
|
//_________________________________________________________________
|
||||||
async deleteExpense(expense_id: number): Promise<DeleteResult> {
|
async deleteExpense(expense_id: number): Promise<DeleteExpenseResult> {
|
||||||
try {
|
try {
|
||||||
await this.prisma.$transaction(async (tx) => {
|
await this.prisma.$transaction(async (tx) => {
|
||||||
const expense = await tx.expenses.findUnique({
|
const expense = await tx.expenses.findUnique({
|
||||||
|
|
@ -139,7 +133,7 @@ export class ExpenseUpsertService {
|
||||||
// LOCAL HELPERS
|
// LOCAL HELPERS
|
||||||
//_________________________________________________________________
|
//_________________________________________________________________
|
||||||
//makes sure that comments are the right length the date is of Date type
|
//makes sure that comments are the right length the date is of Date type
|
||||||
private normalizeExpenseDto(dto: ExpenseDto): Normalized {
|
private normalizeExpenseDto(dto: ExpenseDto): NormalizedExpense {
|
||||||
const date = toDateFromString(dto.date);
|
const date = toDateFromString(dto.date);
|
||||||
const comment = this.truncate280(dto.comment);
|
const comment = this.truncate280(dto.comment);
|
||||||
const supervisor_comment =
|
const supervisor_comment =
|
||||||
|
|
@ -161,21 +155,4 @@ export class ExpenseUpsertService {
|
||||||
if (Number.isNaN(parsed)) throw new Error(`Invalid value : ${value} for ${field}`);
|
if (Number.isNaN(parsed)) throw new Error(`Invalid value : ${value} for ${field}`);
|
||||||
return parsed;
|
return parsed;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
export const expense_select = {
|
|
||||||
id: true,
|
|
||||||
timesheet_id: true,
|
|
||||||
bank_code_id: true,
|
|
||||||
attachment: true,
|
|
||||||
date: true,
|
|
||||||
amount: true,
|
|
||||||
mileage: true,
|
|
||||||
comment: true,
|
|
||||||
supervisor_comment: true,
|
|
||||||
is_approved: true,
|
|
||||||
} satisfies Prisma.ExpensesSelect;
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
import { Injectable } from "@nestjs/common";
|
|
||||||
import { ExpensesArchive } from "@prisma/client";
|
import { ExpensesArchive } from "@prisma/client";
|
||||||
import { PrismaService } from "src/prisma/prisma.service";
|
import { PrismaService } from "src/prisma/prisma.service";
|
||||||
|
import { Injectable } from "@nestjs/common";
|
||||||
|
|
||||||
@Injectable()
|
@Injectable()
|
||||||
export class ExpensesArchivalService {
|
export class ExpensesArchivalService {
|
||||||
|
|
|
||||||
|
|
@ -1,16 +1,16 @@
|
||||||
import { Controller, Param, Query, Body, Get, Post, BadRequestException, ParseIntPipe, Delete, Patch } from "@nestjs/common";
|
import { Controller, Param, Query, Body, Get, Post, BadRequestException, ParseIntPipe, Delete, Patch } from "@nestjs/common";
|
||||||
import { SchedulePresetsCommandService } from "src/time-and-attendance/modules/time-tracker/schedule-presets/services/schedule-presets-command.service";
|
import { SchedulePresetsUpsertService } from "src/time-and-attendance/modules/time-tracker/schedule-presets/services/schedule-presets-upsert.service";
|
||||||
import { SchedulePresetsApplyService } from "src/time-and-attendance/modules/time-tracker/schedule-presets/services/schedule-presets-apply.service";
|
import { SchedulePresetsApplyService } from "src/time-and-attendance/modules/time-tracker/schedule-presets/services/schedule-presets-apply.service";
|
||||||
import { SchedulePresetsQueryService } from "src/time-and-attendance/modules/time-tracker/schedule-presets/services/schedule-presets-query.service";
|
import { SchedulePresetsGetService } from "src/time-and-attendance/modules/time-tracker/schedule-presets/services/schedule-presets-get.service";
|
||||||
import { SchedulePresetsUpdateDto } from "src/time-and-attendance/modules/time-tracker/schedule-presets/dtos/update-schedule-presets.dto";
|
import { SchedulePresetsUpdateDto } from "src/time-and-attendance/modules/time-tracker/schedule-presets/dtos/update-schedule-presets.dto";
|
||||||
import { SchedulePresetsDto } from "src/time-and-attendance/modules/time-tracker/schedule-presets/dtos/create-schedule-presets.dto";
|
import { SchedulePresetsDto } from "src/time-and-attendance/modules/time-tracker/schedule-presets/dtos/create-schedule-presets.dto";
|
||||||
|
|
||||||
@Controller('schedule-presets')
|
@Controller('schedule-presets')
|
||||||
export class SchedulePresetsController {
|
export class SchedulePresetsController {
|
||||||
constructor(
|
constructor(
|
||||||
private readonly commandService: SchedulePresetsCommandService,
|
private readonly upsertService: SchedulePresetsUpsertService,
|
||||||
private readonly applyPresetsService: SchedulePresetsApplyService,
|
private readonly applyPresetsService: SchedulePresetsApplyService,
|
||||||
private readonly queryService: SchedulePresetsQueryService,
|
private readonly getService: SchedulePresetsGetService,
|
||||||
){}
|
){}
|
||||||
|
|
||||||
//used to create a schedule preset
|
//used to create a schedule preset
|
||||||
|
|
@ -19,7 +19,7 @@ export class SchedulePresetsController {
|
||||||
@Param('employee_id', ParseIntPipe) employee_id: number,
|
@Param('employee_id', ParseIntPipe) employee_id: number,
|
||||||
@Body() dto: SchedulePresetsDto,
|
@Body() dto: SchedulePresetsDto,
|
||||||
) {
|
) {
|
||||||
return await this.commandService.createPreset(employee_id, dto);
|
return await this.upsertService.createPreset(employee_id, dto);
|
||||||
}
|
}
|
||||||
|
|
||||||
//used to update an already existing schedule preset
|
//used to update an already existing schedule preset
|
||||||
|
|
@ -28,7 +28,7 @@ export class SchedulePresetsController {
|
||||||
@Param('preset_id', ParseIntPipe) preset_id: number,
|
@Param('preset_id', ParseIntPipe) preset_id: number,
|
||||||
@Body() dto: SchedulePresetsUpdateDto,
|
@Body() dto: SchedulePresetsUpdateDto,
|
||||||
) {
|
) {
|
||||||
return await this.commandService.updatePreset(preset_id, dto);
|
return await this.upsertService.updatePreset(preset_id, dto);
|
||||||
}
|
}
|
||||||
|
|
||||||
//used to delete a schedule preset
|
//used to delete a schedule preset
|
||||||
|
|
@ -36,7 +36,7 @@ export class SchedulePresetsController {
|
||||||
async deletePreset(
|
async deletePreset(
|
||||||
@Param('preset_id') preset_id: number,
|
@Param('preset_id') preset_id: number,
|
||||||
) {
|
) {
|
||||||
return await this.commandService.deletePreset(preset_id);
|
return await this.upsertService.deletePreset(preset_id);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -45,7 +45,7 @@ export class SchedulePresetsController {
|
||||||
async findListById(
|
async findListById(
|
||||||
@Param('employee_id', ParseIntPipe) employee_id: number,
|
@Param('employee_id', ParseIntPipe) employee_id: number,
|
||||||
) {
|
) {
|
||||||
return this.queryService.findSchedulePresets(employee_id);
|
return this.getService.getSchedulePresets(employee_id);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
import { ArrayMinSize, IsArray, IsBoolean, IsOptional, IsString } from "class-validator";
|
import { ArrayMinSize, IsArray, IsBoolean, IsOptional, IsString } from "class-validator";
|
||||||
import { SchedulePresetShiftsDto } from "./create-schedule-preset-shifts.dto";
|
import { SchedulePresetShiftsDto } from "src/time-and-attendance/modules/time-tracker/schedule-presets/dtos/create-schedule-preset-shifts.dto";
|
||||||
|
|
||||||
export class SchedulePresetsDto {
|
export class SchedulePresetsDto {
|
||||||
@IsString()
|
@IsString()
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
import { SchedulePresetsCommandService } from "src/time-and-attendance/modules/time-tracker/schedule-presets/services/schedule-presets-command.service";
|
import { SchedulePresetsUpsertService } from "src/time-and-attendance/modules/time-tracker/schedule-presets/services/schedule-presets-upsert.service";
|
||||||
import { SchedulePresetsApplyService } from "src/time-and-attendance/modules/time-tracker/schedule-presets/services/schedule-presets-apply.service";
|
import { SchedulePresetsApplyService } from "src/time-and-attendance/modules/time-tracker/schedule-presets/services/schedule-presets-apply.service";
|
||||||
import { SchedulePresetsQueryService } from "src/time-and-attendance/modules/time-tracker/schedule-presets/services/schedule-presets-query.service";
|
import { SchedulePresetsGetService } from "src/time-and-attendance/modules/time-tracker/schedule-presets/services/schedule-presets-get.service";
|
||||||
import { SchedulePresetsController } from "src/time-and-attendance/modules/time-tracker/schedule-presets/controller/schedule-presets.controller";
|
import { SchedulePresetsController } from "src/time-and-attendance/modules/time-tracker/schedule-presets/controller/schedule-presets.controller";
|
||||||
import { SharedModule } from "src/time-and-attendance/modules/shared/shared.module";
|
import { SharedModule } from "src/time-and-attendance/modules/shared/shared.module";
|
||||||
import { Module } from "@nestjs/common";
|
import { Module } from "@nestjs/common";
|
||||||
|
|
@ -10,13 +10,13 @@ import { Module } from "@nestjs/common";
|
||||||
imports: [SharedModule],
|
imports: [SharedModule],
|
||||||
controllers: [SchedulePresetsController],
|
controllers: [SchedulePresetsController],
|
||||||
providers: [
|
providers: [
|
||||||
SchedulePresetsCommandService,
|
SchedulePresetsUpsertService,
|
||||||
SchedulePresetsQueryService,
|
SchedulePresetsGetService,
|
||||||
SchedulePresetsApplyService,
|
SchedulePresetsApplyService,
|
||||||
],
|
],
|
||||||
exports:[
|
exports:[
|
||||||
SchedulePresetsCommandService,
|
SchedulePresetsUpsertService,
|
||||||
SchedulePresetsQueryService,
|
SchedulePresetsGetService,
|
||||||
SchedulePresetsApplyService,
|
SchedulePresetsApplyService,
|
||||||
],
|
],
|
||||||
}) export class SchedulePresetsModule {}
|
}) export class SchedulePresetsModule {}
|
||||||
|
|
@ -4,10 +4,10 @@ import { Injectable } from "@nestjs/common";
|
||||||
import { Prisma } from "@prisma/client";
|
import { Prisma } from "@prisma/client";
|
||||||
|
|
||||||
@Injectable()
|
@Injectable()
|
||||||
export class SchedulePresetsQueryService {
|
export class SchedulePresetsGetService {
|
||||||
constructor( private readonly prisma: PrismaService ){}
|
constructor( private readonly prisma: PrismaService ){}
|
||||||
|
|
||||||
async findSchedulePresets(employee_id: number): Promise<PresetResponse[]> {
|
async getSchedulePresets(employee_id: number): Promise<PresetResponse[]> {
|
||||||
try {
|
try {
|
||||||
const presets = await this.prisma.schedulePresets.findMany({
|
const presets = await this.prisma.schedulePresets.findMany({
|
||||||
where: { employee_id },
|
where: { employee_id },
|
||||||
|
|
@ -1,16 +1,13 @@
|
||||||
import { Injectable, BadRequestException, NotFoundException, ConflictException } from "@nestjs/common";
|
import { Injectable, BadRequestException, NotFoundException, ConflictException } from "@nestjs/common";
|
||||||
|
import { CreatePresetResult, DeletePresetResult, UpdatePresetResult } from "src/time-and-attendance/utils/type.utils";
|
||||||
import { SchedulePresetsDto } from "src/time-and-attendance/modules/time-tracker/schedule-presets/dtos/create-schedule-presets.dto";
|
import { SchedulePresetsDto } from "src/time-and-attendance/modules/time-tracker/schedule-presets/dtos/create-schedule-presets.dto";
|
||||||
import { BankCodesResolver } from "src/time-and-attendance/modules/shared/utils/resolve-bank-type-id.utils";
|
import { BankCodesResolver } from "src/time-and-attendance/modules/shared/utils/resolve-bank-type-id.utils";
|
||||||
import { Prisma, Weekday } from "@prisma/client";
|
import { Prisma, Weekday } from "@prisma/client";
|
||||||
import { PrismaService } from "src/prisma/prisma.service";
|
|
||||||
import { toHHmmFromDate } from "src/time-and-attendance/utils/date-time.utils";
|
import { toHHmmFromDate } from "src/time-and-attendance/utils/date-time.utils";
|
||||||
|
import { PrismaService } from "src/prisma/prisma.service";
|
||||||
type DeleteResult = { ok: true; id: number; } | { ok: false; id: number; error: any };
|
|
||||||
type CreateResult = { ok: true; } | { ok: false; error: any };
|
|
||||||
type UpdateResult = { ok: true; id: number; data: SchedulePresetsDto } | { ok: false; id: number; error: any };
|
|
||||||
|
|
||||||
@Injectable()
|
@Injectable()
|
||||||
export class SchedulePresetsCommandService {
|
export class SchedulePresetsUpsertService {
|
||||||
constructor(
|
constructor(
|
||||||
private readonly prisma: PrismaService,
|
private readonly prisma: PrismaService,
|
||||||
private readonly typeResolver : BankCodesResolver,
|
private readonly typeResolver : BankCodesResolver,
|
||||||
|
|
@ -18,7 +15,7 @@ export class SchedulePresetsCommandService {
|
||||||
//_________________________________________________________________
|
//_________________________________________________________________
|
||||||
// CREATE
|
// CREATE
|
||||||
//_________________________________________________________________
|
//_________________________________________________________________
|
||||||
async createPreset( employee_id: number, dto: SchedulePresetsDto): Promise<CreateResult> {
|
async createPreset( employee_id: number, dto: SchedulePresetsDto): Promise<CreatePresetResult> {
|
||||||
try {
|
try {
|
||||||
const shifts_data = await this.resolveAndBuildPresetShifts(dto);
|
const shifts_data = await this.resolveAndBuildPresetShifts(dto);
|
||||||
if(!shifts_data) throw new BadRequestException(`Employee with id: ${employee_id} or dto not found`);
|
if(!shifts_data) throw new BadRequestException(`Employee with id: ${employee_id} or dto not found`);
|
||||||
|
|
@ -49,7 +46,7 @@ export class SchedulePresetsCommandService {
|
||||||
//_________________________________________________________________
|
//_________________________________________________________________
|
||||||
// UPDATE
|
// UPDATE
|
||||||
//_________________________________________________________________
|
//_________________________________________________________________
|
||||||
async updatePreset( preset_id: number, dto: SchedulePresetsDto ): Promise<UpdateResult> {
|
async updatePreset( preset_id: number, dto: SchedulePresetsDto ): Promise<UpdatePresetResult> {
|
||||||
try {
|
try {
|
||||||
const existing = await this.prisma.schedulePresets.findFirst({
|
const existing = await this.prisma.schedulePresets.findFirst({
|
||||||
where: { id: preset_id },
|
where: { id: preset_id },
|
||||||
|
|
@ -137,7 +134,7 @@ export class SchedulePresetsCommandService {
|
||||||
//_________________________________________________________________
|
//_________________________________________________________________
|
||||||
// DELETE
|
// DELETE
|
||||||
//_________________________________________________________________
|
//_________________________________________________________________
|
||||||
async deletePreset( preset_id: number ): Promise <DeleteResult> {
|
async deletePreset( preset_id: number ): Promise <DeletePresetResult> {
|
||||||
try {
|
try {
|
||||||
await this.prisma.$transaction(async (tx) => {
|
await this.prisma.$transaction(async (tx) => {
|
||||||
const preset = await tx.schedulePresets.findFirst({
|
const preset = await tx.schedulePresets.findFirst({
|
||||||
|
|
@ -1,8 +1,8 @@
|
||||||
import { BadRequestException, Body, Controller, Delete, Param, Patch, Post } from "@nestjs/common";
|
import { BadRequestException, Body, Controller, Delete, Param, Patch, Post } from "@nestjs/common";
|
||||||
import { CreateResult, UpdateResult } from "src/time-and-attendance/utils/type.utils";
|
import { CreateShiftResult, UpdateShiftResult } from "src/time-and-attendance/utils/type.utils";
|
||||||
import { ShiftsUpsertService } from "src/time-and-attendance/modules/time-tracker/shifts/services/shifts-upsert.service";
|
import { ShiftsUpsertService } from "src/time-and-attendance/modules/time-tracker/shifts/services/shifts-upsert.service";
|
||||||
import { UpdateShiftDto } from "src/time-and-attendance/modules/time-tracker/shifts/dtos/shift-update.dto";
|
import { UpdateShiftDto } from "src/time-and-attendance/modules/time-tracker/shifts/dtos/shift-update.dto";
|
||||||
import { ShiftDto } from "../dtos/shift-create.dto";
|
import { ShiftDto } from "src/time-and-attendance/modules/time-tracker/shifts/dtos/shift-create.dto";
|
||||||
|
|
||||||
|
|
||||||
@Controller('shift')
|
@Controller('shift')
|
||||||
|
|
@ -11,7 +11,7 @@ export class ShiftController {
|
||||||
|
|
||||||
@Post('create')
|
@Post('create')
|
||||||
createBatch(
|
createBatch(
|
||||||
@Body()dtos: ShiftDto[]): Promise<CreateResult[]> {
|
@Body()dtos: ShiftDto[]): Promise<CreateShiftResult[]> {
|
||||||
const list = Array.isArray(dtos) ? dtos : [];
|
const list = Array.isArray(dtos) ? dtos : [];
|
||||||
if(list.length === 0) throw new BadRequestException('Body is missing or invalid (create shifts)');
|
if(list.length === 0) throw new BadRequestException('Body is missing or invalid (create shifts)');
|
||||||
return this.upsert_service.createShifts(dtos)
|
return this.upsert_service.createShifts(dtos)
|
||||||
|
|
@ -21,7 +21,7 @@ export class ShiftController {
|
||||||
//change Body to receive dtos
|
//change Body to receive dtos
|
||||||
@Patch('update')
|
@Patch('update')
|
||||||
updateBatch(
|
updateBatch(
|
||||||
@Body() dtos: UpdateShiftDto[]): Promise<UpdateResult[]>{
|
@Body() dtos: UpdateShiftDto[]): Promise<UpdateShiftResult[]>{
|
||||||
const list = Array.isArray(dtos) ? dtos: [];
|
const list = Array.isArray(dtos) ? dtos: [];
|
||||||
if(list.length === 0) throw new BadRequestException('Body is missing or invalid (update shifts)');
|
if(list.length === 0) throw new BadRequestException('Body is missing or invalid (update shifts)');
|
||||||
return this.upsert_service.updateShifts(dtos);
|
return this.upsert_service.updateShifts(dtos);
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
import { PartialType, OmitType } from "@nestjs/swagger";
|
import { PartialType, OmitType } from "@nestjs/swagger";
|
||||||
import { ShiftDto } from "./shift-create.dto";
|
import { ShiftDto } from "src/time-and-attendance/modules/time-tracker/shifts/dtos/shift-create.dto";
|
||||||
import { IsInt } from "class-validator";
|
import { IsInt } from "class-validator";
|
||||||
|
|
||||||
export class UpdateShiftDto extends PartialType(
|
export class UpdateShiftDto extends PartialType(
|
||||||
|
|
|
||||||
|
|
@ -1,8 +1,9 @@
|
||||||
import { toStringFromDate, toStringFromHHmm } from "../../../../utils/date-time.utils";
|
import { toStringFromDate, toStringFromHHmm } from "src/time-and-attendance/utils/date-time.utils";
|
||||||
import { Injectable, NotFoundException } from "@nestjs/common";
|
import { Injectable, NotFoundException } from "@nestjs/common";
|
||||||
import { PrismaService } from "src/prisma/prisma.service";
|
import { PrismaService } from "src/prisma/prisma.service";
|
||||||
import { shift_select } from "src/time-and-attendance/utils/selects.utils";
|
import { shift_select } from "src/time-and-attendance/utils/selects.utils";
|
||||||
import { GetShiftDto } from "../dtos/shift-get.dto";
|
import { GetShiftDto } from "src/time-and-attendance/modules/time-tracker/shifts/dtos/shift-get.dto";
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* _____________________________________________________________________________________
|
* _____________________________________________________________________________________
|
||||||
|
|
@ -15,6 +16,7 @@ import { GetShiftDto } from "../dtos/shift-get.dto";
|
||||||
* _____________________________________________________________________________________
|
* _____________________________________________________________________________________
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
@Injectable()
|
@Injectable()
|
||||||
export class ShiftsGetService {
|
export class ShiftsGetService {
|
||||||
constructor(
|
constructor(
|
||||||
|
|
|
||||||
|
|
@ -1,12 +1,12 @@
|
||||||
import { CreateResult, NormedOk, NormedErr, UpdatePayload, UpdateResult, Normalized, UpdateChanges } from "src/time-and-attendance/utils/type.utils";
|
import { CreateShiftResult, NormedOk, NormedErr, UpdateShiftResult, UpdateShiftPayload, UpdateShiftChanges, Normalized } from "src/time-and-attendance/utils/type.utils";
|
||||||
import { overlaps, toDateFromString, toHHmmFromString, toStringFromDate, toStringFromHHmm } from "../../../../utils/date-time.utils";
|
import { overlaps, toStringFromHHmm, toStringFromDate, toDateFromString, toHHmmFromString } from "src/time-and-attendance/utils/date-time.utils";
|
||||||
import { BadRequestException, ConflictException, Injectable, NotFoundException } from "@nestjs/common";
|
import { Injectable, BadRequestException, ConflictException, NotFoundException } from "@nestjs/common";
|
||||||
import { OvertimeService } from "src/time-and-attendance/domains/services/overtime.service";
|
import { OvertimeService } from "src/time-and-attendance/domains/services/overtime.service";
|
||||||
import { UpdateShiftDto } from "src/time-and-attendance/modules/time-tracker/shifts/dtos/shift-update.dto";
|
import { UpdateShiftDto } from "src/time-and-attendance/modules/time-tracker/shifts/dtos/shift-update.dto";
|
||||||
import { PrismaService } from "src/prisma/prisma.service";
|
import { PrismaService } from "src/prisma/prisma.service";
|
||||||
import { shift_select } from "src/time-and-attendance/utils/selects.utils";
|
import { shift_select } from "src/time-and-attendance/utils/selects.utils";
|
||||||
import { GetShiftDto } from "../dtos/shift-get.dto";
|
import { GetShiftDto } from "src/time-and-attendance/modules/time-tracker/shifts/dtos/shift-get.dto";
|
||||||
import { ShiftDto } from "../dtos/shift-create.dto";
|
import { ShiftDto } from "src/time-and-attendance/modules/time-tracker/shifts/dtos/shift-create.dto";
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -25,7 +25,7 @@ export class ShiftsUpsertService {
|
||||||
//checks for overlaping shifts
|
//checks for overlaping shifts
|
||||||
//create new shifts
|
//create new shifts
|
||||||
//calculate overtime
|
//calculate overtime
|
||||||
async createShifts(dtos: ShiftDto[]): Promise<CreateResult[]> {
|
async createShifts(dtos: ShiftDto[]): Promise<CreateShiftResult[]> {
|
||||||
if (!Array.isArray(dtos) || dtos.length === 0) return [];
|
if (!Array.isArray(dtos) || dtos.length === 0) return [];
|
||||||
|
|
||||||
const normed_shift: Array<NormedOk | NormedErr> = dtos.map((dto, index) => {
|
const normed_shift: Array<NormedOk | NormedErr> = dtos.map((dto, index) => {
|
||||||
|
|
@ -66,14 +66,14 @@ export class ShiftsUpsertService {
|
||||||
});
|
});
|
||||||
return dtos.map((_dto, key) =>
|
return dtos.map((_dto, key) =>
|
||||||
indices.includes(key)
|
indices.includes(key)
|
||||||
? ({ ok: false, error: err } as CreateResult)
|
? ({ ok: false, error: err } as CreateShiftResult)
|
||||||
: ({ ok: false, error: new BadRequestException('Batch aborted due to overlaps in another date group') })
|
: ({ ok: false, error: new BadRequestException('Batch aborted due to overlaps in another date group') })
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return this.prisma.$transaction(async (tx) => {
|
return this.prisma.$transaction(async (tx) => {
|
||||||
const results: CreateResult[] = Array.from({ length: dtos.length }, () => ({ ok: false, error: new Error('uninitialized') }));
|
const results: CreateShiftResult[] = Array.from({ length: dtos.length }, () => ({ ok: false, error: new Error('uninitialized') }));
|
||||||
|
|
||||||
|
|
||||||
normed_shift.forEach((x, i) => {
|
normed_shift.forEach((x, i) => {
|
||||||
|
|
@ -157,16 +157,16 @@ export class ShiftsUpsertService {
|
||||||
// update shifts in DB
|
// update shifts in DB
|
||||||
// recalculate overtime after update
|
// recalculate overtime after update
|
||||||
// return an updated version to display
|
// return an updated version to display
|
||||||
async updateShifts(dtos: UpdateShiftDto[]): Promise<UpdateResult[]> {
|
async updateShifts(dtos: UpdateShiftDto[]): Promise<UpdateShiftResult[]> {
|
||||||
if (!Array.isArray(dtos) || dtos.length === 0) return [];
|
if (!Array.isArray(dtos) || dtos.length === 0) return [];
|
||||||
|
|
||||||
const updates: UpdatePayload[] = dtos.map((item) => {
|
const updates: UpdateShiftPayload[] = dtos.map((item) => {
|
||||||
const { id, ...rest } = item;
|
const { id, ...rest } = item;
|
||||||
if (!Number.isInteger(id)) {
|
if (!Number.isInteger(id)) {
|
||||||
throw new BadRequestException('Update shift payload is missing a valid id');
|
throw new BadRequestException('Update shift payload is missing a valid id');
|
||||||
}
|
}
|
||||||
|
|
||||||
const changes: UpdateChanges = {};
|
const changes: UpdateShiftChanges = {};
|
||||||
if (rest.date !== undefined) changes.date = rest.date;
|
if (rest.date !== undefined) changes.date = rest.date;
|
||||||
if (rest.start_time !== undefined) changes.start_time = rest.start_time;
|
if (rest.start_time !== undefined) changes.start_time = rest.start_time;
|
||||||
if (rest.end_time !== undefined) changes.end_time = rest.end_time;
|
if (rest.end_time !== undefined) changes.end_time = rest.end_time;
|
||||||
|
|
@ -189,12 +189,12 @@ export class ShiftsUpsertService {
|
||||||
const existing = regroup_id.get(update.id);
|
const existing = regroup_id.get(update.id);
|
||||||
if (!existing) {
|
if (!existing) {
|
||||||
return updates.map(exist => exist.id === update.id
|
return updates.map(exist => exist.id === update.id
|
||||||
? ({ ok: false, id: update.id, error: new NotFoundException(`Shift with id: ${update.id} not found`) } as UpdateResult)
|
? ({ ok: false, id: update.id, error: new NotFoundException(`Shift with id: ${update.id} not found`) } as UpdateShiftResult)
|
||||||
: ({ ok: false, id: exist.id, error: new BadRequestException('Batch aborted due to missing shift') }));
|
: ({ ok: false, id: exist.id, error: new BadRequestException('Batch aborted due to missing shift') }));
|
||||||
}
|
}
|
||||||
if (existing.is_approved) {
|
if (existing.is_approved) {
|
||||||
return updates.map(exist => exist.id === update.id
|
return updates.map(exist => exist.id === update.id
|
||||||
? ({ ok: false, id: update.id, error: new BadRequestException('Approved shift cannot be updated') } as UpdateResult)
|
? ({ ok: false, id: update.id, error: new BadRequestException('Approved shift cannot be updated') } as UpdateShiftResult)
|
||||||
: ({ ok: false, id: exist.id, error: new BadRequestException('Batch aborted due to approved shift in update set') }));
|
: ({ ok: false, id: exist.id, error: new BadRequestException('Batch aborted due to approved shift in update set') }));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -249,7 +249,7 @@ export class ShiftsUpsertService {
|
||||||
message: 'New shift overlaps with existing shift(s)',
|
message: 'New shift overlaps with existing shift(s)',
|
||||||
conflicts: [{ start_time: toStringFromHHmm(conflict.start), end_time: toStringFromHHmm(conflict.end), type: 'UNKNOWN' }],
|
conflicts: [{ start_time: toStringFromHHmm(conflict.start), end_time: toStringFromHHmm(conflict.end), type: 'UNKNOWN' }],
|
||||||
})
|
})
|
||||||
} as UpdateResult)
|
} as UpdateShiftResult)
|
||||||
: ({ ok: false, id: exist.id, error: new BadRequestException('Batch aborted due to overlap in another update') })
|
: ({ ok: false, id: exist.id, error: new BadRequestException('Batch aborted due to overlap in another update') })
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
@ -271,7 +271,7 @@ export class ShiftsUpsertService {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const results: UpdateResult[] = [];
|
const results: UpdateShiftResult[] = [];
|
||||||
for (const planned of planned_updates) {
|
for (const planned of planned_updates) {
|
||||||
const data: any = {};
|
const data: any = {};
|
||||||
const { dto } = planned.update;
|
const { dto } = planned.update;
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,8 @@
|
||||||
|
|
||||||
import { BusinessLogicsModule } from 'src/time-and-attendance/domains/business-logics.module';
|
import { BusinessLogicsModule } from 'src/time-and-attendance/domains/business-logics.module';
|
||||||
import { ShiftsUpsertService } from './services/shifts-upsert.service';
|
import { ShiftsUpsertService } from 'src/time-and-attendance/modules/time-tracker/shifts/services/shifts-upsert.service';
|
||||||
import { ShiftsGetService } from './services/shifts-get.service';
|
import { ShiftsGetService } from 'src/time-and-attendance/modules/time-tracker/shifts/services/shifts-get.service';
|
||||||
import { ShiftController } from './controllers/shift.controller';
|
import { ShiftController } from 'src/time-and-attendance/modules/time-tracker/shifts/controllers/shift.controller';
|
||||||
import { Module } from '@nestjs/common';
|
import { Module } from '@nestjs/common';
|
||||||
|
|
||||||
@Module({
|
@Module({
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
import { EmailToIdResolver } from "src/time-and-attendance/modules/shared/utils/resolve-email-id.utils";
|
import { GetTimesheetsOverviewService } from "src/time-and-attendance/modules/time-tracker/timesheets/services/timesheet-get-overview.service";
|
||||||
import { GetTimesheetsOverviewService } from "../services/timesheet-get-overview.service";
|
|
||||||
import { BadRequestException, Controller, Get, Query} from "@nestjs/common";
|
import { BadRequestException, Controller, Get, Query} from "@nestjs/common";
|
||||||
|
import { EmailToIdResolver } from "src/time-and-attendance/modules/shared/utils/resolve-email-id.utils";
|
||||||
|
|
||||||
@Controller('timesheets')
|
@Controller('timesheets')
|
||||||
export class TimesheetController {
|
export class TimesheetController {
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
import { Injectable } from "@nestjs/common";
|
|
||||||
import { Prisma, Timesheets } from "@prisma/client";
|
|
||||||
import { BaseApprovalService } from "src/common/shared/base-approval.service";
|
import { BaseApprovalService } from "src/common/shared/base-approval.service";
|
||||||
|
import { Prisma, Timesheets } from "@prisma/client";
|
||||||
import { PrismaService } from "src/prisma/prisma.service";
|
import { PrismaService } from "src/prisma/prisma.service";
|
||||||
|
import { Injectable } from "@nestjs/common";
|
||||||
|
|
||||||
@Injectable()
|
@Injectable()
|
||||||
export class TimesheetApprovalService extends BaseApprovalService<Timesheets>{
|
export class TimesheetApprovalService extends BaseApprovalService<Timesheets>{
|
||||||
|
|
|
||||||
|
|
@ -1,8 +1,8 @@
|
||||||
import { Injectable, NotFoundException } from "@nestjs/common";
|
|
||||||
import { PrismaService } from "src/prisma/prisma.service";
|
|
||||||
import { NUMBER_OF_TIMESHEETS_TO_RETURN } from "src/time-and-attendance/utils/constants.utils";
|
|
||||||
import { sevenDaysFrom, toStringFromDate, toHHmmFromDate, toDateFromString } from "src/time-and-attendance/utils/date-time.utils";
|
import { sevenDaysFrom, toStringFromDate, toHHmmFromDate, toDateFromString } from "src/time-and-attendance/utils/date-time.utils";
|
||||||
|
import { NUMBER_OF_TIMESHEETS_TO_RETURN } from "src/time-and-attendance/utils/constants.utils";
|
||||||
|
import { Injectable, NotFoundException } from "@nestjs/common";
|
||||||
import { TotalExpenses, TotalHours } from "src/time-and-attendance/utils/type.utils";
|
import { TotalExpenses, TotalHours } from "src/time-and-attendance/utils/type.utils";
|
||||||
|
import { PrismaService } from "src/prisma/prisma.service";
|
||||||
|
|
||||||
@Injectable()
|
@Injectable()
|
||||||
export class GetTimesheetsOverviewService {
|
export class GetTimesheetsOverviewService {
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
import { GetTimesheetsOverviewService } from './services/timesheet-get-overview.service';
|
import { GetTimesheetsOverviewService } from 'src/time-and-attendance/modules/time-tracker/timesheets/services/timesheet-get-overview.service';
|
||||||
import { TimesheetArchiveService } from './services/timesheet-archive.service';
|
import { TimesheetArchiveService } from 'src/time-and-attendance/modules/time-tracker/timesheets/services/timesheet-archive.service';
|
||||||
import { TimesheetController } from './controllers/timesheet.controller';
|
import { TimesheetController } from 'src/time-and-attendance/modules/time-tracker/timesheets/controllers/timesheet.controller';
|
||||||
import { SharedModule } from '../../shared/shared.module';
|
import { SharedModule } from 'src/time-and-attendance/modules/shared/shared.module';
|
||||||
import { Module } from '@nestjs/common';
|
import { Module } from '@nestjs/common';
|
||||||
|
|
||||||
@Module({
|
@Module({
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
import { SchedulePresetsCommandService } from "src/time-and-attendance/modules/time-tracker/schedule-presets/services/schedule-presets-command.service";
|
import { SchedulePresetsUpsertService } from "src/time-and-attendance/modules/time-tracker/schedule-presets/services/schedule-presets-upsert.service";
|
||||||
import { GetTimesheetsOverviewService } from "src/time-and-attendance/modules/time-tracker/timesheets/services/timesheet-get-overview.service";
|
import { GetTimesheetsOverviewService } from "src/time-and-attendance/modules/time-tracker/timesheets/services/timesheet-get-overview.service";
|
||||||
import { SchedulePresetsQueryService } from "src/time-and-attendance/modules/time-tracker/schedule-presets/services/schedule-presets-query.service";
|
import { SchedulePresetsGetService } from "src/time-and-attendance/modules/time-tracker/schedule-presets/services/schedule-presets-get.service";
|
||||||
import { SchedulePresetsApplyService } from "src/time-and-attendance/modules/time-tracker/schedule-presets/services/schedule-presets-apply.service";
|
import { SchedulePresetsApplyService } from "src/time-and-attendance/modules/time-tracker/schedule-presets/services/schedule-presets-apply.service";
|
||||||
import { SchedulePresetsController } from "src/time-and-attendance/modules/time-tracker/schedule-presets/controller/schedule-presets.controller";
|
import { SchedulePresetsController } from "src/time-and-attendance/modules/time-tracker/schedule-presets/controller/schedule-presets.controller";
|
||||||
import { BusinessLogicsModule } from "src/time-and-attendance/domains/business-logics.module";
|
import { BusinessLogicsModule } from "src/time-and-attendance/domains/business-logics.module";
|
||||||
|
|
@ -31,8 +31,8 @@ import { Module } from "@nestjs/common";
|
||||||
ShiftsGetService,
|
ShiftsGetService,
|
||||||
ShiftsUpsertService,
|
ShiftsUpsertService,
|
||||||
ExpenseUpsertService,
|
ExpenseUpsertService,
|
||||||
SchedulePresetsCommandService,
|
SchedulePresetsUpsertService,
|
||||||
SchedulePresetsQueryService,
|
SchedulePresetsGetService,
|
||||||
SchedulePresetsApplyService,
|
SchedulePresetsApplyService,
|
||||||
],
|
],
|
||||||
exports: [],
|
exports: [],
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,7 @@ export const NUMBER_OF_TIMESHEETS_TO_RETURN = 2;
|
||||||
export const DAILY_LIMIT_HOURS = 8;
|
export const DAILY_LIMIT_HOURS = 8;
|
||||||
export const WEEKLY_LIMIT_HOURS = 40;
|
export const WEEKLY_LIMIT_HOURS = 40;
|
||||||
export const PAY_PERIOD_ANCHOR = 2023-12-17;
|
export const PAY_PERIOD_ANCHOR = 2023-12-17;
|
||||||
export const ANCHOR_ISO = '2023-12-17'; // ancre date
|
export const ANCHOR_ISO = '2023-12-17';
|
||||||
export const PERIOD_DAYS = 14;
|
export const PERIOD_DAYS = 14;
|
||||||
export const PERIODS_PER_YEAR = 26;
|
export const PERIODS_PER_YEAR = 26;
|
||||||
export const MS_PER_DAY = 86_400_000;
|
export const MS_PER_DAY = 86_400_000;
|
||||||
|
|
|
||||||
|
|
@ -4,6 +4,9 @@ import { UpdateShiftDto } from "src/time-and-attendance/modules/time-tracker/shi
|
||||||
import { GetShiftDto } from "src/time-and-attendance/modules/time-tracker/shifts/dtos/shift-get.dto";
|
import { GetShiftDto } from "src/time-and-attendance/modules/time-tracker/shifts/dtos/shift-get.dto";
|
||||||
import { ShiftDto } from "src/time-and-attendance/modules/time-tracker/shifts/dtos/shift-create.dto";
|
import { ShiftDto } from "src/time-and-attendance/modules/time-tracker/shifts/dtos/shift-create.dto";
|
||||||
import { Prisma } from "@prisma/client";
|
import { Prisma } from "@prisma/client";
|
||||||
|
import { SchedulePresetsDto } from "src/time-and-attendance/modules/time-tracker/schedule-presets/dtos/create-schedule-presets.dto";
|
||||||
|
import { GetExpenseDto } from "src/time-and-attendance/modules/expenses/dtos/expense-get.dto";
|
||||||
|
import { updateExpenseDto } from "src/time-and-attendance/modules/expenses/dtos/expense-update.dto";
|
||||||
|
|
||||||
export type TotalHours = {
|
export type TotalHours = {
|
||||||
regular: number;
|
regular: number;
|
||||||
|
|
@ -29,11 +32,24 @@ export type ShiftWithOvertimeDto = {
|
||||||
overtime: WeekOvertimeSummary;
|
overtime: WeekOvertimeSummary;
|
||||||
};
|
};
|
||||||
|
|
||||||
export type CreateResult = { ok: true; data: ShiftWithOvertimeDto } | { ok: false; error: any };
|
export type CreateShiftResult = { ok: true; data: ShiftWithOvertimeDto } | { ok: false; error: any };
|
||||||
export type UpdateChanges = Omit<UpdateShiftDto, 'id'>;
|
export type UpdateShiftChanges = Omit<UpdateShiftDto, 'id'>;
|
||||||
export type UpdatePayload = { id: number; dto: UpdateChanges };
|
export type UpdateShiftPayload = { id: number; dto: UpdateShiftChanges };
|
||||||
export type UpdateResult = { ok: true; id: number; data: ShiftWithOvertimeDto } | { ok: false; id: number; error: any };
|
export type UpdateShiftResult = { ok: true; id: number; data: ShiftWithOvertimeDto } | { ok: false; id: number; error: any };
|
||||||
export type DeleteResult = { ok: true; id: number; overtime: WeekOvertimeSummary } | { ok: false; id: number; error: any };
|
export type DeleteShiftResult = { ok: true; id: number; overtime: WeekOvertimeSummary } | { ok: false; id: number; error: any };
|
||||||
|
|
||||||
|
export type DeletePresetResult = { ok: true; id: number; } | { ok: false; id: number; error: any };
|
||||||
|
export type CreatePresetResult = { ok: true; } | { ok: false; error: any };
|
||||||
|
export type UpdatePresetResult = { ok: true; id: number; data: SchedulePresetsDto } | { ok: false; id: number; error: any };
|
||||||
|
|
||||||
|
export type NormalizedExpense = { date: Date; comment: string; supervisor_comment?: string; };
|
||||||
|
|
||||||
|
export type CreateExpenseResult = { ok: true; data: GetExpenseDto } | { ok: false; error: any };
|
||||||
|
export type UpdateExpensePayload = { id: number; dto: updateExpenseDto };
|
||||||
|
export type UpdateExpenseResult = { ok: true; id: number; data: GetExpenseDto } | { ok: false; id: number; error: any };
|
||||||
|
export type DeleteExpenseResult = { ok: true; id: number; } | { ok: false; id: number; error: any };
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
export type NormedOk = { index: number; dto: ShiftDto; normed: Normalized };
|
export type NormedOk = { index: number; dto: ShiftDto; normed: Normalized };
|
||||||
export type NormedErr = { index: number; error: any };
|
export type NormedErr = { index: number; error: any };
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user