Add field management module with database schema and validation
- Introduced `FieldModule` to manage cycles and plans, including read and write controllers. - Created database migrations for `company_settings`, `cycles`, `cycle_weekdays`, `cycle_destinations`, `plans`, `plan_destinations`, `plan_invoices`, and `plan_packing_slips` tables, including constraints and unique indexes. - Developed service and repository layers for handling cycle and plan data operations. - Added unit tests for the cycles and plans services, repositories, and controllers to ensure functionality and correctness. - Updated application module to include the new `FieldModule` for better organization.
This commit is contained in:
@@ -0,0 +1,15 @@
|
||||
import { bigint, pgTable, uuid } from 'drizzle-orm/pg-core';
|
||||
import { primaryEntityColumns } from './primary-entity-columns';
|
||||
import { users } from './schema';
|
||||
|
||||
/**
|
||||
* Company-wide operational settings (singleton aggregate).
|
||||
*/
|
||||
export const companySettings = pgTable('company_settings', {
|
||||
id: uuid('id').defaultRandom().notNull().primaryKey(),
|
||||
cycleStartDate: bigint('cycle_start_date', { mode: 'number' }).notNull(),
|
||||
...primaryEntityColumns(users),
|
||||
});
|
||||
|
||||
export type CompanySettingsRow = typeof companySettings.$inferSelect;
|
||||
export type NewCompanySettingsRow = typeof companySettings.$inferInsert;
|
||||
Reference in New Issue
Block a user