feat(Tickets): created helpers for boolean manipulations and basic setup for ticketing module

This commit is contained in:
Matthieu Haineault 2026-02-11 08:45:26 -05:00
parent 3f248a212d
commit dccb249b15
6 changed files with 74 additions and 2 deletions

View File

@ -100,6 +100,7 @@ model account_memo {
}
//NOT USED BY THE TICKET MODULE *********************
model compta_comptes {
id BigInt @id @default(autoincrement())
category String? @db.VarChar(64)
@ -107,6 +108,7 @@ model compta_comptes {
desc String? @db.MediumText
}
//NOT USED BY THE TICKET MODULE *********************
model compta_comptes_soldes {
id BigInt @id @default(autoincrement())
num_compte Int
@ -116,6 +118,7 @@ model compta_comptes_soldes {
type String @db.VarChar(3)
}
//NOT USED BY THE TICKET MODULE *********************
model compta_journal_ecriture {
id BigInt @id @default(autoincrement())
date_orig BigInt?
@ -132,6 +135,7 @@ model compta_journal_ecriture {
@@index([num], map: "num")
}
//NOT USED BY THE TICKET MODULE *********************
model compta_journal_ecriture_bk {
id BigInt @id @default(autoincrement())
date_orig BigInt?
@ -148,6 +152,7 @@ model compta_journal_ecriture_bk {
@@index([num], map: "num")
}
//NOT USED BY THE TICKET MODULE *********************
model compta_journal_ecriture_detail {
id BigInt @id @default(autoincrement())
journal_id BigInt?
@ -158,6 +163,7 @@ model compta_journal_ecriture_detail {
@@index([journal_id], map: "journal_id")
}
//NOT USED BY THE TICKET MODULE *********************
model compta_journal_ecriture_detail_bk {
id BigInt @id @default(autoincrement())
journal_id BigInt?
@ -172,11 +178,13 @@ model compta_periode {
month Int @id @default(7)
}
/// This model or at least one of its fields has comments in the database, and requires an additional setup for migrations: Read more: https://pris.ly/d/database-comments
//NOT USED BY THE TICKET MODULE *********************
model compta_ppa_file_id {
last_id Int @id @default(1)
}
//NOT USED BY THE TICKET MODULE *********************
model compta_setup {
setup_id Int @id @default(1)
period_month Int @default(7)
@ -189,12 +197,14 @@ model compta_setup {
imap_token String? @db.Text
}
//NOT USED BY THE TICKET MODULE *********************
model credit_code {
id Int @id @default(autoincrement())
code String @db.VarChar(16)
desc String @db.VarChar(256)
}
//NOT USED BY THE TICKET MODULE *********************
model tax {
id Int @id @default(autoincrement())
name String? @db.VarChar(128)
@ -202,6 +212,7 @@ model tax {
rate Float?
}
//NOT USED BY THE TICKET MODULE *********************
model tax_group {
id Int @id @default(autoincrement())
name String? @db.VarChar(128)
@ -209,6 +220,7 @@ model tax_group {
tax String? @db.VarChar(128)
}
//NOT USED BY THE TICKET MODULE *********************
model td_payable {
id Int @id @default(autoincrement()) @db.UnsignedInt
ticket_id Int @default(0) @db.UnsignedInt
@ -225,6 +237,7 @@ model td_payable {
@@index([ticket_id], map: "ticket_id")
}
//NOT USED BY THE TICKET MODULE *********************
model conso {
id BigInt @id @default(autoincrement())
ip_id String? @db.VarChar(16)
@ -236,6 +249,7 @@ model conso {
@@index([ip_id], map: "ip_id")
}
//NOT USED BY THE TICKET MODULE *********************
model conso_archive {
id BigInt @id @default(autoincrement())
ip_id String? @db.VarChar(16)
@ -247,6 +261,7 @@ model conso_archive {
@@index([ip_id], map: "ip_id")
}
//NOT USED BY THE TICKET MODULE *********************
model conso_avis {
id Int @id @default(autoincrement()) @db.UnsignedInt
date BigInt
@ -257,6 +272,7 @@ model conso_avis {
avis String @db.VarChar(32)
}
//NOT USED BY THE TICKET MODULE *********************
model conso_radius {
id BigInt @id @default(autoincrement()) @db.UnsignedBigInt
username String @db.VarChar(32)
@ -269,6 +285,7 @@ model conso_radius {
@@index([username], map: "username")
}
//NOT USED BY THE TICKET MODULE *********************
model conso_radius_daily {
id Int @id @default(autoincrement()) @db.UnsignedInt
username String @db.VarChar(32)
@ -282,6 +299,7 @@ model conso_radius_daily {
@@index([username], map: "username")
}
//NOT USED BY THE TICKET MODULE *********************
model conso_radius_daily2 {
id BigInt @id @default(autoincrement()) @db.UnsignedBigInt
username String @db.VarChar(32)
@ -295,6 +313,7 @@ model conso_radius_daily2 {
@@index([username], map: "username")
}
//NOT USED BY THE TICKET MODULE *********************
model conso_radius_hourly {
id Int @id @default(autoincrement()) @db.UnsignedInt
username String @db.VarChar(32)
@ -306,6 +325,7 @@ model conso_radius_hourly {
@@index([username], map: "username")
}
//NOT USED BY THE TICKET MODULE *********************
model conso_radius_monthly {
id Int @id @default(autoincrement()) @db.UnsignedInt
date String @db.VarChar(32)
@ -317,6 +337,7 @@ model conso_radius_monthly {
@@index([username], map: "username")
}
//NOT USED BY THE TICKET MODULE *********************
model conso_radius_monthly2 {
id Int @id @default(autoincrement()) @db.UnsignedInt
date String @db.VarChar(32)
@ -359,6 +380,7 @@ model delivery {
@@index([placemarks_id], map: "placemarks_id")
}
model delivery_history {
id Int @id @default(autoincrement()) @db.UnsignedInt
account_id Int @db.UnsignedInt

View File

@ -0,0 +1,38 @@
//This file is used to store function that help translate MariaDB data to Typescript manipulation requirements for the type "boolean".
import { PhoneAddrEnhancedCapable } from "src/customer-support/phones/phone.dto";
//From MariaDB to Frontend
export const fromTinyIntToBoolean = async (tinyInt: number): Promise<boolean> => {
let booleanValue = true;
if ((tinyInt = 0) || (tinyInt = -1)) return booleanValue = false;
return booleanValue;
}
//From Frontend to MariaDB TinyInt boolean 1 - 0
export const fromBooleanToTinyInt = async (boolean: boolean): Promise<number> => {
return boolean ? 1 : 0;
}
//From Frontend to MariaDB TinyInt boolean -1 - 1
export const fromBooleanToTinyIntNegative = async (boolean: boolean): Promise<number> => {
return boolean ? 1 : -1;
}
//From MariaDB to Frontend String boolean yes - no / Y - N / etc...
export const fromStringToBoolean = async (string: string): Promise<boolean> => {
let booleanValue = true;
let stringValue = string.toLowerCase();
if ((stringValue = "n") || (stringValue = "no") || (stringValue = "non")) {
return booleanValue = false;
}
return booleanValue;
}
export const fromBooleanToEnum = async (boolean: boolean): Promise<PhoneAddrEnhancedCapable> => {
return boolean ? PhoneAddrEnhancedCapable.Y : PhoneAddrEnhancedCapable.N;
}
export const fromEnumToBoolean = async (enumValue: PhoneAddrEnhancedCapable): Promise<boolean> => {
return enumValue ? true : false;
}

View File

@ -0,0 +1 @@
//This file is used to store function that help translate MariaDB data to Typescript manipulation requirements for the type "number".

View File

@ -0,0 +1 @@
//This file is used to store function that help translate MariaDB data to Typescript manipulation requirements for the type "string".

View File

@ -1,7 +1,11 @@
import { Controller } from "@nestjs/common";
import { TicketService } from "src/customer-support/tickets/ticket.service";
@Controller()
export class TicketController {
constructor(private readonly getService: TicketService) { }
}

View File

@ -1,6 +1,12 @@
import { Injectable } from "@nestjs/common";
import { PrismaMariaDbService } from "prisma/mariadb/prisma-mariadb.service";
import { Result } from "src/common/errors/result-error.factory";
import { Tickets } from "src/customer-support/tickets/ticket.dto";
@Injectable()
export class TicketService {
constructor(private readonly prisma: PrismaMariaDbService) { }
}