Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
269 changes: 269 additions & 0 deletions database.types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -649,6 +649,275 @@ export type Database = {
},
]
}
cw_device_report_assignments: {
Row: {
created_at: string
dev_eui: string
id: number
is_active: boolean
template_id: number
}
Insert: {
created_at?: string
dev_eui: string
id?: number
is_active?: boolean
template_id: number
}
Update: {
created_at?: string
dev_eui?: string
id?: number
is_active?: boolean
template_id?: number
}
Relationships: [
{
foreignKeyName: "cw_device_report_assignments_dev_eui_fkey"
columns: ["dev_eui"]
isOneToOne: false
referencedRelation: "cw_devices"
referencedColumns: ["dev_eui"]
},
{
foreignKeyName: "cw_device_report_assignments_template_id_fkey"
columns: ["template_id"]
isOneToOne: false
referencedRelation: "cw_report_templates"
referencedColumns: ["id"]
},
]
}
cw_report_template_alert_points: {
Row: {
created_at: string
data_point_key: string
hex_color: string | null
id: number
max: number | null
min: number | null
name: string
operator: string | null
template_id: number
value: number | null
}
Insert: {
created_at?: string
data_point_key: string
hex_color?: string | null
id?: number
max?: number | null
min?: number | null
name: string
operator?: string | null
template_id: number
value?: number | null
}
Update: {
created_at?: string
data_point_key?: string
hex_color?: string | null
id?: number
max?: number | null
min?: number | null
name?: string
operator?: string | null
template_id?: number
value?: number | null
}
Relationships: [
{
foreignKeyName: "cw_report_template_alert_points_template_id_fkey"
columns: ["template_id"]
isOneToOne: false
referencedRelation: "cw_report_templates"
referencedColumns: ["id"]
},
]
}
cw_report_template_data_processing_schedules: {
Row: {
created_at: string
crosses_midnight: boolean
day_of_week: number
end_time: string
id: string
is_enabled: boolean
rule_type: string
start_time: string
template_id: number
timezone: string
updated_at: string
valid_from: string | null
valid_to: string | null
}
Insert: {
created_at?: string
crosses_midnight?: boolean
day_of_week: number
end_time: string
id?: string
is_enabled?: boolean
rule_type?: string
start_time: string
template_id: number
timezone?: string
updated_at?: string
valid_from?: string | null
valid_to?: string | null
}
Update: {
created_at?: string
crosses_midnight?: boolean
day_of_week?: number
end_time?: string
id?: string
is_enabled?: boolean
rule_type?: string
start_time?: string
template_id?: number
timezone?: string
updated_at?: string
valid_from?: string | null
valid_to?: string | null
}
Relationships: [
{
foreignKeyName: "cw_report_template_data_processing_sche_template_id_fkey"
columns: ["template_id"]
isOneToOne: false
referencedRelation: "cw_report_templates"
referencedColumns: ["id"]
},
]
}
cw_report_template_recipients: {
Row: {
communication_method: number
created_at: string
email: string | null
id: number
name: string | null
template_id: number
}
Insert: {
communication_method: number
created_at?: string
email?: string | null
id?: number
name?: string | null
template_id: number
}
Update: {
communication_method?: number
created_at?: string
email?: string | null
id?: number
name?: string | null
template_id?: number
}
Relationships: [
{
foreignKeyName: "cw_report_template_recipients_communicat_communication_meth_fkey"
columns: ["communication_method"]
isOneToOne: false
referencedRelation: "communication_methods"
referencedColumns: ["communication_method_id"]
},
{
foreignKeyName: "cw_report_template_recipients_template_id_fkey"
columns: ["template_id"]
isOneToOne: false
referencedRelation: "cw_report_templates"
referencedColumns: ["id"]
},
]
}
cw_report_template_schedule: {
Row: {
created_at: string
end_of_day: boolean
end_of_month: boolean
end_of_week: boolean
id: number
is_active: boolean
template_id: number
utc_offset: number
}
Insert: {
created_at?: string
end_of_day?: boolean
end_of_month?: boolean
end_of_week?: boolean
id?: number
is_active?: boolean
template_id: number
utc_offset?: number
}
Update: {
created_at?: string
end_of_day?: boolean
end_of_month?: boolean
end_of_week?: boolean
id?: number
is_active?: boolean
template_id?: number
utc_offset?: number
}
Relationships: [
{
foreignKeyName: "cw_report_template_schedule_template_id_fkey"
columns: ["template_id"]
isOneToOne: false
referencedRelation: "cw_report_templates"
referencedColumns: ["id"]
},
]
}
cw_report_templates: {
Row: {
created_at: string
created_by: string | null
data_pull_interval: number
description: string | null
device_type_id: number | null
id: number
is_active: boolean
legacy_report_id: string | null
name: string
}
Insert: {
created_at?: string
created_by?: string | null
data_pull_interval?: number
description?: string | null
device_type_id?: number | null
id?: number
is_active?: boolean
legacy_report_id?: string | null
name: string
}
Update: {
created_at?: string
created_by?: string | null
data_pull_interval?: number
description?: string | null
device_type_id?: number | null
id?: number
is_active?: boolean
legacy_report_id?: string | null
name?: string
}
Relationships: [
{
foreignKeyName: "cw_report_templates_created_by_fkey"
columns: ["created_by"]
isOneToOne: false
referencedRelation: "profiles"
referencedColumns: ["id"]
},
]
}
cw_device_rule_assignments: {
Row: {
created_at: string | null
Expand Down
2 changes: 2 additions & 0 deletions src/app.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import { DevicesModule } from './v1/devices/devices.module';
import { RulesModule } from './v1/rules/rules.module';
import { RulesNewModule } from './v1/rules-new/rules-new.module';
import { ReportsModule } from './v1/reports/reports.module';
import { ReportsNewModule } from './v1/reports-new/reports-new.module';
import { PaymentsModule } from './v1/payments/payments.module';
import { LocationsModule } from './v1/locations/locations.module';
import { RelayModule } from './v1/relay/relay.module';
Expand Down Expand Up @@ -56,6 +57,7 @@ import { DashboardModule } from './v1/dashboard/dashboard.module';
RulesModule,
RulesNewModule,
ReportsModule,
ReportsNewModule,
PaymentsModule,
LocationsModule,
RelayModule,
Expand Down
15 changes: 15 additions & 0 deletions src/v1/reports-new/dto/communication-method.dto.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import { ApiProperty } from '@nestjs/swagger';

export class CommunicationMethodDto {
@ApiProperty({
description:
'Stable identifier referenced by cw_report_template_recipients.communication_method.',
})
communicationMethodId: number;

@ApiProperty({ nullable: true, required: false })
name: string | null;

@ApiProperty()
isActive: boolean;
}
19 changes: 19 additions & 0 deletions src/v1/reports-new/dto/report-form-context.dto.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import { ApiProperty } from '@nestjs/swagger';
import { DeviceDto } from '../../devices/dto/device.dto';
import { LocationDto } from '../../locations/dto/location.dto';
import { CommunicationMethodDto } from './communication-method.dto';
import { ReportTemplateDto } from './report-template.dto';

export class ReportFormContextDto {
@ApiProperty({ type: () => DeviceDto, isArray: true })
devices: DeviceDto[];

@ApiProperty({ type: () => LocationDto, isArray: true })
locations: LocationDto[];

@ApiProperty({ type: () => CommunicationMethodDto, isArray: true })
communicationMethods: CommunicationMethodDto[];

@ApiProperty({ type: () => ReportTemplateDto, nullable: true, required: false })
template: ReportTemplateDto | null;
}
33 changes: 33 additions & 0 deletions src/v1/reports-new/dto/report-template-alert-point.dto.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
import { ApiProperty } from '@nestjs/swagger';

export class ReportTemplateAlertPointDto {
@ApiProperty()
id: number;

@ApiProperty()
templateId: number;

@ApiProperty()
name: string;

@ApiProperty()
dataPointKey: string;

@ApiProperty({ nullable: true, required: false })
operator: string | null;

@ApiProperty({ nullable: true, required: false })
min: number | null;

@ApiProperty({ nullable: true, required: false })
max: number | null;

@ApiProperty({ nullable: true, required: false })
value: number | null;

@ApiProperty({ nullable: true, required: false })
hexColor: string | null;

@ApiProperty({ nullable: true, required: false, format: 'date-time' })
createdAt: string | null;
}
27 changes: 27 additions & 0 deletions src/v1/reports-new/dto/report-template-assignment.dto.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
import { ApiProperty } from '@nestjs/swagger';

export class ReportTemplateAssignmentDto {
@ApiProperty()
id: number;

@ApiProperty()
devEui: string;

@ApiProperty()
templateId: number;

@ApiProperty()
isActive: boolean;

@ApiProperty({ nullable: true, required: false, format: 'date-time' })
createdAt: string | null;

@ApiProperty({ nullable: true, required: false })
deviceName: string | null;

@ApiProperty({ nullable: true, required: false })
locationName: string | null;

@ApiProperty({ nullable: true, required: false })
permissionLevel: number | null;
}
Loading