feat(Tickets): created helpers for boolean manipulations and basic setup for ticketing module
This commit is contained in:
parent
3f248a212d
commit
dccb249b15
|
|
@ -100,6 +100,7 @@ model account_memo {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//NOT USED BY THE TICKET MODULE *********************
|
||||||
model compta_comptes {
|
model compta_comptes {
|
||||||
id BigInt @id @default(autoincrement())
|
id BigInt @id @default(autoincrement())
|
||||||
category String? @db.VarChar(64)
|
category String? @db.VarChar(64)
|
||||||
|
|
@ -107,6 +108,7 @@ model compta_comptes {
|
||||||
desc String? @db.MediumText
|
desc String? @db.MediumText
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//NOT USED BY THE TICKET MODULE *********************
|
||||||
model compta_comptes_soldes {
|
model compta_comptes_soldes {
|
||||||
id BigInt @id @default(autoincrement())
|
id BigInt @id @default(autoincrement())
|
||||||
num_compte Int
|
num_compte Int
|
||||||
|
|
@ -116,6 +118,7 @@ model compta_comptes_soldes {
|
||||||
type String @db.VarChar(3)
|
type String @db.VarChar(3)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//NOT USED BY THE TICKET MODULE *********************
|
||||||
model compta_journal_ecriture {
|
model compta_journal_ecriture {
|
||||||
id BigInt @id @default(autoincrement())
|
id BigInt @id @default(autoincrement())
|
||||||
date_orig BigInt?
|
date_orig BigInt?
|
||||||
|
|
@ -132,6 +135,7 @@ model compta_journal_ecriture {
|
||||||
@@index([num], map: "num")
|
@@index([num], map: "num")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//NOT USED BY THE TICKET MODULE *********************
|
||||||
model compta_journal_ecriture_bk {
|
model compta_journal_ecriture_bk {
|
||||||
id BigInt @id @default(autoincrement())
|
id BigInt @id @default(autoincrement())
|
||||||
date_orig BigInt?
|
date_orig BigInt?
|
||||||
|
|
@ -148,6 +152,7 @@ model compta_journal_ecriture_bk {
|
||||||
@@index([num], map: "num")
|
@@index([num], map: "num")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//NOT USED BY THE TICKET MODULE *********************
|
||||||
model compta_journal_ecriture_detail {
|
model compta_journal_ecriture_detail {
|
||||||
id BigInt @id @default(autoincrement())
|
id BigInt @id @default(autoincrement())
|
||||||
journal_id BigInt?
|
journal_id BigInt?
|
||||||
|
|
@ -158,6 +163,7 @@ model compta_journal_ecriture_detail {
|
||||||
@@index([journal_id], map: "journal_id")
|
@@index([journal_id], map: "journal_id")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//NOT USED BY THE TICKET MODULE *********************
|
||||||
model compta_journal_ecriture_detail_bk {
|
model compta_journal_ecriture_detail_bk {
|
||||||
id BigInt @id @default(autoincrement())
|
id BigInt @id @default(autoincrement())
|
||||||
journal_id BigInt?
|
journal_id BigInt?
|
||||||
|
|
@ -172,11 +178,13 @@ model compta_periode {
|
||||||
month Int @id @default(7)
|
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 {
|
model compta_ppa_file_id {
|
||||||
last_id Int @id @default(1)
|
last_id Int @id @default(1)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//NOT USED BY THE TICKET MODULE *********************
|
||||||
model compta_setup {
|
model compta_setup {
|
||||||
setup_id Int @id @default(1)
|
setup_id Int @id @default(1)
|
||||||
period_month Int @default(7)
|
period_month Int @default(7)
|
||||||
|
|
@ -189,12 +197,14 @@ model compta_setup {
|
||||||
imap_token String? @db.Text
|
imap_token String? @db.Text
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//NOT USED BY THE TICKET MODULE *********************
|
||||||
model credit_code {
|
model credit_code {
|
||||||
id Int @id @default(autoincrement())
|
id Int @id @default(autoincrement())
|
||||||
code String @db.VarChar(16)
|
code String @db.VarChar(16)
|
||||||
desc String @db.VarChar(256)
|
desc String @db.VarChar(256)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//NOT USED BY THE TICKET MODULE *********************
|
||||||
model tax {
|
model tax {
|
||||||
id Int @id @default(autoincrement())
|
id Int @id @default(autoincrement())
|
||||||
name String? @db.VarChar(128)
|
name String? @db.VarChar(128)
|
||||||
|
|
@ -202,6 +212,7 @@ model tax {
|
||||||
rate Float?
|
rate Float?
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//NOT USED BY THE TICKET MODULE *********************
|
||||||
model tax_group {
|
model tax_group {
|
||||||
id Int @id @default(autoincrement())
|
id Int @id @default(autoincrement())
|
||||||
name String? @db.VarChar(128)
|
name String? @db.VarChar(128)
|
||||||
|
|
@ -209,6 +220,7 @@ model tax_group {
|
||||||
tax String? @db.VarChar(128)
|
tax String? @db.VarChar(128)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//NOT USED BY THE TICKET MODULE *********************
|
||||||
model td_payable {
|
model td_payable {
|
||||||
id Int @id @default(autoincrement()) @db.UnsignedInt
|
id Int @id @default(autoincrement()) @db.UnsignedInt
|
||||||
ticket_id Int @default(0) @db.UnsignedInt
|
ticket_id Int @default(0) @db.UnsignedInt
|
||||||
|
|
@ -225,6 +237,7 @@ model td_payable {
|
||||||
@@index([ticket_id], map: "ticket_id")
|
@@index([ticket_id], map: "ticket_id")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//NOT USED BY THE TICKET MODULE *********************
|
||||||
model conso {
|
model conso {
|
||||||
id BigInt @id @default(autoincrement())
|
id BigInt @id @default(autoincrement())
|
||||||
ip_id String? @db.VarChar(16)
|
ip_id String? @db.VarChar(16)
|
||||||
|
|
@ -236,6 +249,7 @@ model conso {
|
||||||
@@index([ip_id], map: "ip_id")
|
@@index([ip_id], map: "ip_id")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//NOT USED BY THE TICKET MODULE *********************
|
||||||
model conso_archive {
|
model conso_archive {
|
||||||
id BigInt @id @default(autoincrement())
|
id BigInt @id @default(autoincrement())
|
||||||
ip_id String? @db.VarChar(16)
|
ip_id String? @db.VarChar(16)
|
||||||
|
|
@ -247,6 +261,7 @@ model conso_archive {
|
||||||
@@index([ip_id], map: "ip_id")
|
@@index([ip_id], map: "ip_id")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//NOT USED BY THE TICKET MODULE *********************
|
||||||
model conso_avis {
|
model conso_avis {
|
||||||
id Int @id @default(autoincrement()) @db.UnsignedInt
|
id Int @id @default(autoincrement()) @db.UnsignedInt
|
||||||
date BigInt
|
date BigInt
|
||||||
|
|
@ -257,6 +272,7 @@ model conso_avis {
|
||||||
avis String @db.VarChar(32)
|
avis String @db.VarChar(32)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//NOT USED BY THE TICKET MODULE *********************
|
||||||
model conso_radius {
|
model conso_radius {
|
||||||
id BigInt @id @default(autoincrement()) @db.UnsignedBigInt
|
id BigInt @id @default(autoincrement()) @db.UnsignedBigInt
|
||||||
username String @db.VarChar(32)
|
username String @db.VarChar(32)
|
||||||
|
|
@ -269,6 +285,7 @@ model conso_radius {
|
||||||
@@index([username], map: "username")
|
@@index([username], map: "username")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//NOT USED BY THE TICKET MODULE *********************
|
||||||
model conso_radius_daily {
|
model conso_radius_daily {
|
||||||
id Int @id @default(autoincrement()) @db.UnsignedInt
|
id Int @id @default(autoincrement()) @db.UnsignedInt
|
||||||
username String @db.VarChar(32)
|
username String @db.VarChar(32)
|
||||||
|
|
@ -282,6 +299,7 @@ model conso_radius_daily {
|
||||||
@@index([username], map: "username")
|
@@index([username], map: "username")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//NOT USED BY THE TICKET MODULE *********************
|
||||||
model conso_radius_daily2 {
|
model conso_radius_daily2 {
|
||||||
id BigInt @id @default(autoincrement()) @db.UnsignedBigInt
|
id BigInt @id @default(autoincrement()) @db.UnsignedBigInt
|
||||||
username String @db.VarChar(32)
|
username String @db.VarChar(32)
|
||||||
|
|
@ -295,6 +313,7 @@ model conso_radius_daily2 {
|
||||||
@@index([username], map: "username")
|
@@index([username], map: "username")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//NOT USED BY THE TICKET MODULE *********************
|
||||||
model conso_radius_hourly {
|
model conso_radius_hourly {
|
||||||
id Int @id @default(autoincrement()) @db.UnsignedInt
|
id Int @id @default(autoincrement()) @db.UnsignedInt
|
||||||
username String @db.VarChar(32)
|
username String @db.VarChar(32)
|
||||||
|
|
@ -306,6 +325,7 @@ model conso_radius_hourly {
|
||||||
@@index([username], map: "username")
|
@@index([username], map: "username")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//NOT USED BY THE TICKET MODULE *********************
|
||||||
model conso_radius_monthly {
|
model conso_radius_monthly {
|
||||||
id Int @id @default(autoincrement()) @db.UnsignedInt
|
id Int @id @default(autoincrement()) @db.UnsignedInt
|
||||||
date String @db.VarChar(32)
|
date String @db.VarChar(32)
|
||||||
|
|
@ -317,6 +337,7 @@ model conso_radius_monthly {
|
||||||
@@index([username], map: "username")
|
@@index([username], map: "username")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//NOT USED BY THE TICKET MODULE *********************
|
||||||
model conso_radius_monthly2 {
|
model conso_radius_monthly2 {
|
||||||
id Int @id @default(autoincrement()) @db.UnsignedInt
|
id Int @id @default(autoincrement()) @db.UnsignedInt
|
||||||
date String @db.VarChar(32)
|
date String @db.VarChar(32)
|
||||||
|
|
@ -359,6 +380,7 @@ model delivery {
|
||||||
@@index([placemarks_id], map: "placemarks_id")
|
@@index([placemarks_id], map: "placemarks_id")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
model delivery_history {
|
model delivery_history {
|
||||||
id Int @id @default(autoincrement()) @db.UnsignedInt
|
id Int @id @default(autoincrement()) @db.UnsignedInt
|
||||||
account_id Int @db.UnsignedInt
|
account_id Int @db.UnsignedInt
|
||||||
|
|
|
||||||
38
src/customer-support/shared/helpers/boolean.helpers.ts
Normal file
38
src/customer-support/shared/helpers/boolean.helpers.ts
Normal 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;
|
||||||
|
}
|
||||||
1
src/customer-support/shared/helpers/number.helpers.ts
Normal file
1
src/customer-support/shared/helpers/number.helpers.ts
Normal file
|
|
@ -0,0 +1 @@
|
||||||
|
//This file is used to store function that help translate MariaDB data to Typescript manipulation requirements for the type "number".
|
||||||
1
src/customer-support/shared/helpers/string.helpers.ts
Normal file
1
src/customer-support/shared/helpers/string.helpers.ts
Normal file
|
|
@ -0,0 +1 @@
|
||||||
|
//This file is used to store function that help translate MariaDB data to Typescript manipulation requirements for the type "string".
|
||||||
|
|
@ -1,7 +1,11 @@
|
||||||
import { Controller } from "@nestjs/common";
|
import { Controller } from "@nestjs/common";
|
||||||
|
import { TicketService } from "src/customer-support/tickets/ticket.service";
|
||||||
|
|
||||||
|
|
||||||
@Controller()
|
@Controller()
|
||||||
export class TicketController {
|
export class TicketController {
|
||||||
|
|
||||||
|
constructor(private readonly getService: TicketService) { }
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
@ -1,6 +1,12 @@
|
||||||
import { Injectable } from "@nestjs/common";
|
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()
|
@Injectable()
|
||||||
export class TicketService {
|
export class TicketService {
|
||||||
|
|
||||||
|
constructor(private readonly prisma: PrismaMariaDbService) { }
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
Loading…
Reference in New Issue
Block a user