Make Arvan DNS updates opt-in and persist English user names.
Domain add/edit only upserts Arvan records when updateDns is true, and super-admin user PATCH now accepts firstNameEn and lastNameEn. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
co-authored by
Cursor
parent
f61bba317e
commit
8609d8d4fd
@@ -1,16 +1,38 @@
|
||||
import { IsOptional, IsString, MinLength } from 'class-validator';
|
||||
import {
|
||||
IsOptional,
|
||||
IsString,
|
||||
MaxLength,
|
||||
MinLength,
|
||||
ValidateIf,
|
||||
} from 'class-validator';
|
||||
|
||||
export class UpdateUserDto {
|
||||
@IsOptional()
|
||||
@IsString()
|
||||
@MinLength(1)
|
||||
@MaxLength(100)
|
||||
firstName?: string;
|
||||
|
||||
@IsOptional()
|
||||
@IsString()
|
||||
@MinLength(1)
|
||||
@MaxLength(100)
|
||||
lastName?: string;
|
||||
|
||||
@IsOptional()
|
||||
@IsString()
|
||||
@ValidateIf((_, value) => typeof value === 'string' && value.trim().length > 0)
|
||||
@MinLength(2)
|
||||
@MaxLength(100)
|
||||
firstNameEn?: string;
|
||||
|
||||
@IsOptional()
|
||||
@IsString()
|
||||
@ValidateIf((_, value) => typeof value === 'string' && value.trim().length > 0)
|
||||
@MinLength(2)
|
||||
@MaxLength(100)
|
||||
lastNameEn?: string;
|
||||
|
||||
@IsOptional()
|
||||
@IsString()
|
||||
email?: string;
|
||||
|
||||
@@ -24,6 +24,8 @@ type UserListRow = {
|
||||
id: bigint;
|
||||
firstName: string | null;
|
||||
lastName: string | null;
|
||||
firstNameEn: string | null;
|
||||
lastNameEn: string | null;
|
||||
cellNumber: string;
|
||||
roles: string | null;
|
||||
roleSlug: string | null;
|
||||
@@ -171,7 +173,10 @@ export class UsersService {
|
||||
AND (
|
||||
u.first_name ILIKE ${nameLike}
|
||||
OR u.last_name ILIKE ${nameLike}
|
||||
OR u.first_name_en ILIKE ${nameLike}
|
||||
OR u.last_name_en ILIKE ${nameLike}
|
||||
OR (COALESCE(u.first_name, '') || ' ' || COALESCE(u.last_name, '')) ILIKE ${nameLike}
|
||||
OR (COALESCE(u.first_name_en, '') || ' ' || COALESCE(u.last_name_en, '')) ILIKE ${nameLike}
|
||||
)
|
||||
` : Prisma.empty}
|
||||
${cellNumberIlikeFilter(query.cellNumber)}
|
||||
@@ -209,6 +214,8 @@ export class UsersService {
|
||||
u.id AS "id",
|
||||
u.first_name AS "firstName",
|
||||
u.last_name AS "lastName",
|
||||
u.first_name_en AS "firstNameEn",
|
||||
u.last_name_en AS "lastNameEn",
|
||||
u.cell_number AS "cellNumber",
|
||||
u.created_at AS "createdAt",
|
||||
u.is_active AS "isActive",
|
||||
@@ -464,6 +471,10 @@ export class UsersService {
|
||||
data: {
|
||||
firstName: dto.firstName?.trim(),
|
||||
lastName: dto.lastName?.trim(),
|
||||
firstNameEn:
|
||||
dto.firstNameEn !== undefined ? dto.firstNameEn.trim() || null : undefined,
|
||||
lastNameEn:
|
||||
dto.lastNameEn !== undefined ? dto.lastNameEn.trim() || null : undefined,
|
||||
email: dto.email !== undefined ? dto.email.trim() || null : undefined,
|
||||
cellNumber: dto.cellNumber?.trim(),
|
||||
},
|
||||
@@ -473,6 +484,8 @@ export class UsersService {
|
||||
id: updated.id,
|
||||
firstName: updated.firstName,
|
||||
lastName: updated.lastName,
|
||||
firstNameEn: updated.firstNameEn,
|
||||
lastNameEn: updated.lastNameEn,
|
||||
email: updated.email,
|
||||
cellNumber: updated.cellNumber,
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user