@b2eoneauth/client-dto 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md ADDED
@@ -0,0 +1,7 @@
1
+ # client-dto
2
+
3
+ This library was generated with [Nx](https://nx.dev).
4
+
5
+ ## Building
6
+
7
+ Run `nx build client-dto` to build the library.
package/package.json ADDED
@@ -0,0 +1,20 @@
1
+ {
2
+ "name": "@b2eoneauth/client-dto",
3
+ "version": "1.0.0",
4
+ "type": "module",
5
+ "main": "./dist/index.js",
6
+ "module": "./dist/index.js",
7
+ "types": "./dist/index.d.ts",
8
+ "exports": {
9
+ "./package.json": "./package.json",
10
+ ".": {
11
+ "@oneauth/source": "./src/index.ts",
12
+ "types": "./dist/index.d.ts",
13
+ "import": "./dist/index.js",
14
+ "default": "./dist/index.js"
15
+ }
16
+ },
17
+ "dependencies": {
18
+ "tslib": "^2.3.0"
19
+ }
20
+ }
package/src/index.ts ADDED
@@ -0,0 +1,17 @@
1
+ export * from './lib/user/create-user.dto.js';
2
+ export * from './lib/user/create-user-role.dto.js';
3
+ export * from './lib/user/create-user-response.dto.js';
4
+
5
+ export * from './lib/role/create-role.dto.js';
6
+ export * from './lib/role/create-role-response.dto.js';
7
+
8
+ export * from './lib/app/create-app.dto.js';
9
+ export * from './lib/app/create-app-response.dto.js';
10
+
11
+ export * from './lib/tenant/create-tenant.dto.js';
12
+ export * from './lib/tenant/create-tenant-response.dto.js';
13
+
14
+ export * from './lib/business/create-business.dto.js';
15
+ export * from './lib/business/create-business-response.dto.js';
16
+
17
+ export * from './lib/client-dto.js';
@@ -0,0 +1,5 @@
1
+ import { BaseClientResponseDto } from "../client-dto.js";
2
+
3
+ export interface CreateAppResponseDto extends BaseClientResponseDto {
4
+ displayTitle: string;
5
+ }
@@ -0,0 +1,9 @@
1
+ import { BaseClientRequestDto } from "../client-dto.js";
2
+
3
+ export class CreateAppDto extends BaseClientRequestDto {
4
+
5
+ displayTitle!: string;
6
+
7
+ businessId!: string;
8
+
9
+ }
@@ -0,0 +1,6 @@
1
+ import { BaseClientResponseDto } from "../client-dto.js";
2
+
3
+ export interface CreateBusinessResponseDto extends BaseClientResponseDto {
4
+
5
+ displayTitle: string;
6
+ }
@@ -0,0 +1,27 @@
1
+ import { IsOptional, IsString, Length } from "class-validator";
2
+ import { BaseClientRequestDto } from "../client-dto.js";
3
+ import { ApiProperty } from "@nestjs/swagger";
4
+
5
+ export class CreateBusinessDto extends BaseClientRequestDto {
6
+
7
+ @ApiProperty({ required: true })
8
+ @IsString()
9
+ tenantId!: string;
10
+
11
+ @ApiProperty({ required: true })
12
+ @Length(3, 30)
13
+ displayTitle!: string;
14
+
15
+ @ApiProperty({ required: false })
16
+ @IsOptional()
17
+ gstNumber?: string;
18
+
19
+ @ApiProperty({ required: false })
20
+ @IsOptional()
21
+ panNumber?: string;
22
+
23
+ @ApiProperty({ required: false })
24
+ @IsOptional()
25
+ addressLine1?: string;
26
+
27
+ }
@@ -0,0 +1,69 @@
1
+ import { IsOptional, IsDate } from 'class-validator';
2
+ import { Type } from 'class-transformer';
3
+
4
+ export abstract class BaseClientRequestDto {
5
+
6
+ @IsOptional()
7
+ @IsDate()
8
+ @Type(() => Date)
9
+ createdAt?: Date;
10
+
11
+ @IsOptional()
12
+ createdBy?: string;
13
+
14
+ @IsOptional()
15
+ @IsDate()
16
+ @Type(() => Date)
17
+ updatedAt?: Date;
18
+
19
+ @IsOptional()
20
+ updatedBy?: string;
21
+
22
+ @IsOptional()
23
+ @IsDate()
24
+ @Type(() => Date)
25
+ deletedAt?: Date;
26
+
27
+ @IsOptional()
28
+ deletedBy?: string;
29
+ }
30
+
31
+
32
+ export interface BaseClientResponseDto {
33
+
34
+ id: string;
35
+
36
+ createdAt: Date;
37
+
38
+ createdBy: string;
39
+
40
+ updatedAt: Date;
41
+
42
+ updatedBy: string;
43
+
44
+ deletedAt: Date;
45
+
46
+ deletedBy: string;
47
+
48
+ }
49
+
50
+ export type DefaultRoleType = 'Product Admin' | 'Tenant Admin' | 'Business Admin';
51
+
52
+ export enum DefaultRoleEnum {
53
+ PRODUCT_ADMIN = 'Product Admin',
54
+ TENANT_ADMIN = 'Tenant Admin',
55
+ BUSINESS_ADMIN = 'Business Admin',
56
+ }
57
+
58
+ export enum ActiveStatusEnum {
59
+ ACTIVE = 'Active',
60
+ INACTIVE = 'Inactive',
61
+ PENDING = 'Pending',
62
+ SOFT_DELETED = 'Soft Delete',
63
+ HARD_DELETED = 'Hard Delete',
64
+ SUSPENDED = 'Suspended',
65
+ BLOCKED = 'Blocked',
66
+ TEMPORARY_SUSPENDED = 'Temporary Suspended'
67
+ }
68
+
69
+ export type DeleteAction = 'soft' | 'hard';
@@ -0,0 +1,5 @@
1
+ import { BaseClientResponseDto } from "../client-dto.js";
2
+
3
+ export interface CreateRoleResponseDto extends BaseClientResponseDto {
4
+ displayTitle: string;
5
+ }
@@ -0,0 +1,15 @@
1
+ import { IsString, Length } from "class-validator";
2
+ import { BaseClientRequestDto } from "../client-dto.js";
3
+ import { ApiProperty } from "@nestjs/swagger";
4
+
5
+ export class CreateRoleDto extends BaseClientRequestDto {
6
+
7
+ @ApiProperty({ required: true })
8
+ @Length(3, 20)
9
+ displayTitle!: string;
10
+
11
+ @ApiProperty({ required: true })
12
+ @IsString()
13
+ businessId!: string;
14
+
15
+ }
@@ -0,0 +1,5 @@
1
+ import { BaseClientResponseDto } from "../client-dto.js";
2
+
3
+ export interface CreateTenantResponseDto extends BaseClientResponseDto {
4
+ displayTitle: string;
5
+ }
@@ -0,0 +1,25 @@
1
+ import { IsEmail, IsOptional, IsString } from "class-validator";
2
+ import { Type } from "class-transformer";
3
+ import { ApiProperty } from '@nestjs/swagger'
4
+ import { BaseClientRequestDto } from "../client-dto.js";
5
+
6
+ export class CreateTenantDto extends BaseClientRequestDto {
7
+
8
+ @ApiProperty({ required: true })
9
+ @Type(() => String)
10
+ @IsEmail()
11
+ emailId!: string;
12
+
13
+ @ApiProperty({ required: true })
14
+ @IsString()
15
+ firstName!: string;
16
+
17
+ @ApiProperty({ required: true })
18
+ @IsString()
19
+ lastName!: string;
20
+
21
+ @ApiProperty({ required: false, nullable: true })
22
+ @IsOptional()
23
+ domain?: string;
24
+
25
+ }
@@ -0,0 +1,19 @@
1
+ import { ActiveStatusEnum, BaseClientResponseDto, DefaultRoleEnum } from "../client-dto.js";
2
+
3
+ export interface CreateUserResponseDto extends BaseClientResponseDto {
4
+ tenantId: string;
5
+
6
+ businessId: string;
7
+
8
+ emailId: string;
9
+
10
+ phone: string;
11
+
12
+ status: ActiveStatusEnum;
13
+
14
+ emailVerified: boolean;
15
+
16
+ phoneVerified: boolean;
17
+
18
+ userType: DefaultRoleEnum;
19
+ }
@@ -0,0 +1,15 @@
1
+ import { IsString } from "class-validator";
2
+ import { BaseClientRequestDto } from "../client-dto.js";
3
+ import { ApiProperty } from "@nestjs/swagger";
4
+
5
+ export class CreateUserRoleDto extends BaseClientRequestDto {
6
+
7
+ @ApiProperty({ required: true })
8
+ @IsString()
9
+ userId!: string;
10
+
11
+ @ApiProperty({ required: true })
12
+ @IsString()
13
+ roleId!: string;
14
+
15
+ }
@@ -0,0 +1,57 @@
1
+ import { IsBoolean, IsEmail, IsEnum, IsOptional, IsPhoneNumber, IsString } from "class-validator";
2
+ import { ActiveStatusEnum, BaseClientRequestDto, DefaultRoleEnum } from "../client-dto.js";
3
+ import { ApiProperty } from "@nestjs/swagger";
4
+
5
+ export class CreateUserDto extends BaseClientRequestDto {
6
+
7
+ @ApiProperty({ required: true })
8
+ @IsEmail()
9
+ emailId!: string;
10
+
11
+ @ApiProperty({ required: false })
12
+ @IsOptional()
13
+ tenantId?: string;
14
+
15
+ @ApiProperty({ required: false })
16
+ @IsOptional()
17
+ businessId?: string;
18
+
19
+ @ApiProperty({ required: false })
20
+ @IsOptional()
21
+ firstName?: string;
22
+
23
+ @ApiProperty({ required: false })
24
+ @IsOptional()
25
+ lastName?: string;
26
+
27
+ @ApiProperty({ required: false })
28
+ @IsOptional()
29
+ @IsPhoneNumber('IN')
30
+ phone?: string;
31
+
32
+ @ApiProperty({ required: false })
33
+ @IsOptional()
34
+ @IsEnum(ActiveStatusEnum)
35
+ status?: ActiveStatusEnum;
36
+
37
+ @ApiProperty({ required: false })
38
+ @IsOptional()
39
+ @IsBoolean()
40
+ emailVerified?: boolean;
41
+
42
+ @ApiProperty({ required: false })
43
+ @IsOptional()
44
+ @IsBoolean()
45
+ phoneVerified?: boolean;
46
+
47
+ @ApiProperty({ required: false })
48
+ @IsOptional()
49
+ @IsString()
50
+ password?: string;
51
+
52
+ @ApiProperty({ required: false })
53
+ @IsOptional()
54
+ @IsEnum(DefaultRoleEnum)
55
+ userType?: DefaultRoleEnum;
56
+
57
+ }
package/tsconfig.json ADDED
@@ -0,0 +1,10 @@
1
+ {
2
+ "extends": "../../tsconfig.base.json",
3
+ "files": [],
4
+ "include": [],
5
+ "references": [
6
+ {
7
+ "path": "./tsconfig.lib.json"
8
+ }
9
+ ]
10
+ }
@@ -0,0 +1,16 @@
1
+ {
2
+ "extends": "../../tsconfig.base.json",
3
+ "compilerOptions": {
4
+ "baseUrl": ".",
5
+ "rootDir": "src",
6
+ "outDir": "dist",
7
+ "tsBuildInfoFile": "dist/tsconfig.lib.tsbuildinfo",
8
+ "emitDeclarationOnly": false,
9
+ "forceConsistentCasingInFileNames": true,
10
+ "experimentalDecorators": true,
11
+ "emitDecoratorMetadata": true,
12
+ "types": ["node"]
13
+ },
14
+ "include": ["src/**/*.ts"],
15
+ "references": []
16
+ }