Files
trackgo-be/src/modules/field/settings/dto/company-setting.dto.ts
T
shancheas 4b48dbdf3c Add timeline tracking features with database schema updates
- Introduced new tables `timeline_footprints` and `timeline_activities` to manage employee location data and activity records.
- Updated `company_settings` to include `gps_interval_seconds` and `checkout_warning_radius_meters` for enhanced tracking configuration.
- Implemented foreign key constraints to ensure data integrity between new tables and existing `employees`, `customers`, and `visits` tables.
- Created services and controllers for handling timeline activities and footprints, including ingestion and retrieval of data.
- Enhanced DTOs and validation logic to support new fields and ensure correct data formats in API requests.
- Added unit and integration tests to validate the new functionalities and ensure proper handling of timeline records.
- Created migration scripts to apply the necessary database schema changes for the new features.
2026-09-01 20:36:47 +07:00

75 lines
1.5 KiB
TypeScript

import { ApiProperty, ApiPropertyOptional } from '@nestjs/swagger';
import {
IsInt,
IsNotEmpty,
IsOptional,
IsString,
Matches,
Max,
Min,
} from 'class-validator';
export class UpdateCompanySettingDto {
@ApiPropertyOptional({ example: '2026-01-05', description: 'YYYY-MM-DD' })
@IsOptional()
@IsString()
@IsNotEmpty()
@Matches(/^\d{4}-\d{2}-\d{2}$/, {
message: 'cycleStartDate must be a calendar date',
})
cycleStartDate?: string;
@ApiPropertyOptional({ example: 100, minimum: 1, maximum: 10000 })
@IsOptional()
@IsInt()
@Min(1)
@Max(10_000)
checkInRadiusMeters?: number;
@ApiPropertyOptional({ example: 5, minimum: 5, maximum: 300 })
@IsOptional()
@IsInt()
@Min(5)
@Max(300)
gpsIntervalSeconds?: number;
@ApiPropertyOptional({ example: 200, minimum: 1, maximum: 10000 })
@IsOptional()
@IsInt()
@Min(1)
@Max(10_000)
checkoutWarningRadiusMeters?: number;
}
export class CompanySettingDto {
@ApiProperty({ format: 'uuid' })
id!: string;
@ApiProperty({ description: 'Unix ms start of the cycle-start calendar day' })
cycleStartDate!: number;
@ApiProperty({ example: 100 })
checkInRadiusMeters!: number;
@ApiProperty({ example: 5 })
gpsIntervalSeconds!: number;
@ApiProperty({ example: 200 })
checkoutWarningRadiusMeters!: number;
@ApiProperty()
status!: string;
@ApiProperty()
createdAt!: number;
@ApiProperty()
updatedAt!: number;
@ApiProperty({ format: 'uuid' })
createdBy!: string;
@ApiProperty({ format: 'uuid' })
updatedBy!: string;
}