|
@@ -89,7 +89,7 @@ export class SystemParamsService {
|
|
|
// ---------- CRUD ----------
|
|
// ---------- CRUD ----------
|
|
|
async create(dto: CreateSystemParamDto) {
|
|
async create(dto: CreateSystemParamDto) {
|
|
|
const now = this.nowSec();
|
|
const now = this.nowSec();
|
|
|
- const normalized = this.normalizeValue(dto.value, dto.type);
|
|
|
|
|
|
|
+ const normalized = this.normalizeValue(dto.value, dto.dataType);
|
|
|
|
|
|
|
|
// retry up to 3 times in rare duplicate-id races
|
|
// retry up to 3 times in rare duplicate-id races
|
|
|
for (let attempt = 0; attempt < 3; attempt++) {
|
|
for (let attempt = 0; attempt < 3; attempt++) {
|
|
@@ -99,7 +99,7 @@ export class SystemParamsService {
|
|
|
data: {
|
|
data: {
|
|
|
id,
|
|
id,
|
|
|
side: dto.side as ParamSide,
|
|
side: dto.side as ParamSide,
|
|
|
- type: dto.type,
|
|
|
|
|
|
|
+ dataType: dto.dataType,
|
|
|
name: dto.name,
|
|
name: dto.name,
|
|
|
value: normalized,
|
|
value: normalized,
|
|
|
remark: dto.remark ?? null,
|
|
remark: dto.remark ?? null,
|
|
@@ -124,14 +124,14 @@ export class SystemParamsService {
|
|
|
|
|
|
|
|
async update(dto: UpdateSystemParamDto) {
|
|
async update(dto: UpdateSystemParamDto) {
|
|
|
const now = this.nowSec();
|
|
const now = this.nowSec();
|
|
|
- const normalized = this.normalizeValue(dto.value, dto.type);
|
|
|
|
|
|
|
+ const normalized = this.normalizeValue(dto.value, dto.dataType);
|
|
|
|
|
|
|
|
try {
|
|
try {
|
|
|
return await this.mongoPrismaService.systemParam.update({
|
|
return await this.mongoPrismaService.systemParam.update({
|
|
|
where: { id: dto.id },
|
|
where: { id: dto.id },
|
|
|
data: {
|
|
data: {
|
|
|
side: dto.side as ParamSide,
|
|
side: dto.side as ParamSide,
|
|
|
- type: dto.type,
|
|
|
|
|
|
|
+ dataType: dto.dataType,
|
|
|
name: dto.name,
|
|
name: dto.name,
|
|
|
value: normalized,
|
|
value: normalized,
|
|
|
remark: dto.remark ?? null,
|
|
remark: dto.remark ?? null,
|
|
@@ -167,7 +167,7 @@ export class SystemParamsService {
|
|
|
where.remark = { contains: dto.remark, mode: 'insensitive' };
|
|
where.remark = { contains: dto.remark, mode: 'insensitive' };
|
|
|
}
|
|
}
|
|
|
if (dto.side) where.side = dto.side as ParamSide;
|
|
if (dto.side) where.side = dto.side as ParamSide;
|
|
|
- if (dto.type) where.type = dto.type;
|
|
|
|
|
|
|
+ if (dto.dataType) where.dataType = dto.dataType;
|
|
|
|
|
|
|
|
const [total, data] = await this.mongoPrismaService.$transaction([
|
|
const [total, data] = await this.mongoPrismaService.$transaction([
|
|
|
this.mongoPrismaService.systemParam.count({ where }),
|
|
this.mongoPrismaService.systemParam.count({ where }),
|