2026_08_31
This commit is contained in:
commit
73015386e9
2320 files changed
+80291
No files matched your search
@@ -0,0 +1,70 @@
|
||||
import { Injectable } from "@nestjs/common";
|
||||
import { ProConTextDto } from "src/_dto/procon/proconTexte.dto";
|
||||
import { ProConAggregateEntity } from "src/_sql/procon.Aggregat.entity";
|
||||
import { ProConTextEntity } from "src/_sql/procon.Texte.entity";
|
||||
import { SqlService } from "src/infrastructure/sql/sql.service";
|
||||
|
||||
@Injectable()
|
||||
export class TexteRepository {
|
||||
|
||||
constructor(
|
||||
private readonly db: SqlService,
|
||||
) { }
|
||||
|
||||
fields = [
|
||||
"Id",
|
||||
"Height",
|
||||
"PositionX",
|
||||
"PositionY",
|
||||
"Width",
|
||||
"Show",
|
||||
"Discriminator",
|
||||
"PositionZ",
|
||||
"FontFamily",
|
||||
"FontSize",
|
||||
"FontWeight",
|
||||
"Hintergrund",
|
||||
"Nummer",
|
||||
"TexteVisualisierung_Text",
|
||||
"TextFarbe"
|
||||
];
|
||||
async findAll(anlageId: string): Promise<ProConTextEntity[]> {
|
||||
const pool = await this.db.getPool(anlageId);
|
||||
|
||||
|
||||
const result = await pool
|
||||
.request()
|
||||
.query(`
|
||||
SELECT
|
||||
${this.fields.join(',')}
|
||||
|
||||
FROM Visualisierungen
|
||||
WHERE Discriminator='TexteVisualisierung'
|
||||
`);
|
||||
|
||||
const data = result.recordset as ProConTextEntity[];
|
||||
return data;
|
||||
}
|
||||
|
||||
async findBy(anlageId: string, options: { id?: number, nummer?: number }): Promise<ProConTextDto | undefined> {
|
||||
const pool = await this.db.getPool(anlageId);
|
||||
|
||||
let where = "";
|
||||
if (options.id) where += `Id=${options.id}`;
|
||||
if (options.nummer) where += `Nummer=${options.nummer}`;
|
||||
|
||||
if (where === "" || options.id && options.nummer) return undefined;
|
||||
|
||||
const result = await pool
|
||||
.request()
|
||||
.query(`
|
||||
SELECT
|
||||
${this.fields.join(',')}
|
||||
FROM Visualisierungen
|
||||
WHERE ${where}
|
||||
`);
|
||||
|
||||
return result.recordset[0];
|
||||
}
|
||||
|
||||
}
|
||||
Reference in new issue
Block a user