File

apps/recallassess/recallassess-api/src/api/client/account/dto/account.dto.ts

Index

Properties

Properties

Optional company_id
Type : number
Decorators :
@Expose()
message
Type : string
Decorators :
@Expose()
Optional participant_id
Type : number
Decorators :
@Expose()
success
Type : boolean
Decorators :
@Expose()
import { Exclude, Expose, Type } from "class-transformer";
import { IsEmail, IsNumber, IsOptional, IsString, Matches, Min, MinLength } from "class-validator";

@Exclude()
export class CreateAccountFromSignupDto {
  // Company infos
  @Expose()
  @IsString()
  company_name!: string;

  @Expose()
  @IsEmail()
  company_email!: string;

  @Expose()
  @IsOptional()
  @IsString()
  @Matches(/^\+?[\d\s]+$/, {
    message: "Phone number can only contain digits, spaces, and an optional plus (+) symbol for country code",
  })
  company_phone?: string;

  // Admin user info
  @Expose()
  @IsString()
  admin_first_name!: string;

  @Expose()
  @IsString()
  admin_last_name!: string;

  @Expose()
  @IsEmail()
  admin_email!: string;

  @Expose()
  @IsOptional()
  @IsString()
  @Matches(/^\+?[\d\s]+$/, {
    message: "Phone number can only contain digits, spaces, and an optional plus (+) symbol for country code",
  })
  admin_phone?: string;

  @Expose()
  @IsOptional()
  @IsString()
  admin_address?: string;

  @Expose()
  @IsOptional()
  @IsString()
  admin_city?: string;

  @Expose()
  @IsOptional()
  @IsString()
  admin_country?: string;

  @Expose()
  @IsOptional()
  @IsString()
  @MinLength(8, { message: "Password must be at least 8 characters long" })
  @Matches(/[A-Z]/, {
    message: "Password must contain at least one uppercase letter",
  })
  @Matches(/\d/, { message: "Password must contain at least one number" })
  @Matches(/[\W_]/, {
    message: "Password must contain at least one special character",
  })
  admin_password?: string;

  // Package info
  @Expose()
  @IsNumber()
  package_id!: number;

  @Expose()
  @IsNumber()
  @Min(1)
  license_count!: number;

  @Expose()
  @Type(() => Number)
  @IsNumber()
  unit_price!: number;

  @Expose()
  @Type(() => Number)
  @IsNumber()
  total_amount!: number;

  // VAT (for regions like UAE)
  // Note: Currently calculated server-side based on admin_country (e.g. 5% for AE)

  // Billing cycle
  @Expose()
  @IsOptional()
  @IsString()
  billing_cycle?: string; // QUARTERLY, HALF_YEARLY, ANNUAL

  // Promo code
  @Expose()
  @IsOptional()
  @IsString()
  promo_code?: string;

  // Payment info (for paid plans)
  @Expose()
  @IsOptional()
  @IsString()
  payment_intent_id?: string;

  // Setup info (for trial packages - $0 amounts)
  @Expose()
  @IsOptional()
  @IsString()
  setup_intent_id?: string;

  @Expose()
  @IsOptional()
  @IsString()
  stripe_customer_id?: string;
}

@Exclude()
export class AccountCreationResponseDto {
  @Expose()
  success!: boolean;
  @Expose()
  company_id?: number;
  @Expose()
  participant_id?: number;
  @Expose()
  message!: string;

  // Send temporary credentials via email, don't return in response
  // temporary_password will be sent via email
}

results matching ""

    No results matching ""