law-common 8.7.1-beta.0 → 8.8.1-beta.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.
@@ -17,3 +17,4 @@ export type IBankFlowConfig = {
17
17
  export interface IBankEntityGet extends IBankApiEntity {
18
18
  intermediaryBankDetails?: IIntermediaryBankApiEntityArray;
19
19
  }
20
+ export type IBankEntityGetArray = IBankEntityGet[];
@@ -1,4 +1,5 @@
1
- import { IBankActionDataDto, IBankEntity, IEntityUpdateDto } from "../../entities";
1
+ import { IBankActionDataDto, IBankEntity, IEntityUpdateDto, IIntermediaryBankUpdateDto } from "../../entities";
2
2
  export interface IBankUpdateDto extends IEntityUpdateDto<IBankEntity> {
3
3
  actionData?: IBankActionDataDto;
4
+ intermediaryBankDetails?: IIntermediaryBankUpdateDto[];
4
5
  }
@@ -1,7 +1,9 @@
1
- import { BankTypeEnum, BillingActionsEnum, BillingInvoiceTypeEnum, BillingStatusEnum, IAuditColumnEntity, IBillingEntity, IBillingTimesheetDetail, PaymentStatusEnum } from "../../entities";
1
+ import { BillingActionsEnum, BillingInvoiceTypeEnum, BillingStatusEnum, IAuditColumnEntity, IBillingEntity, IBillingTimesheetDetail, PaymentStatusEnum } from "../../entities";
2
2
  import { IBillingApiEntity } from "./billing.entity.api";
3
3
  import { IBillingTimesheetApiEntity } from "./billing.timesheet.entity.api";
4
4
  import { IUpdateBillingDto } from "./billing.update.dto.interface";
5
+ import { IProjectApiEntity } from "./project.entity.response";
6
+ import { IUserApiEntity } from "./user.entity.api";
5
7
  export interface IBillingEntityResponse extends IAuditColumnEntity {
6
8
  id: number;
7
9
  startDate: string;
@@ -19,6 +21,13 @@ export type IBillingEntityGet = {
19
21
  billing: IBillingApiEntity;
20
22
  billingTimesheets: IBillingTimesheetApiEntity[];
21
23
  };
24
+ export interface IBillingEntitySearchResponse {
25
+ billings: IBillingEntityGet[];
26
+ users?: IUserApiEntity[];
27
+ projects?: IProjectApiEntity[];
28
+ }
29
+ export interface IBillingEntitySearchResponseInclude extends IBillingEntitySearchResponse {
30
+ }
22
31
  export type IBillingEntityUpdateGet = {
23
32
  id: number;
24
33
  startDate: string;
@@ -42,10 +51,8 @@ export type IBillingEntityUpdateGet = {
42
51
  invoicePdfUrl?: string | null;
43
52
  invoiceContactName: string;
44
53
  bankId: number;
45
- bankType: BankTypeEnum;
46
54
  timesheets: IBillingTimesheetApiEntity[];
47
55
  };
48
- export type IBillingEntityGetArray = IBillingEntityGet[];
49
56
  export type IBillingFlowConfig = {
50
57
  [key in BillingStatusEnum]?: {
51
58
  actions: {
@@ -1,2 +1,3 @@
1
1
  export declare const timesheetViewThreshold = "timesheetViewThreshold";
2
2
  export declare const timesheetThreshold = "timesheetThreshold";
3
+ export declare const timesheetEnterThreshold = "timesheetEnterThreshold";
@@ -1,5 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.timesheetThreshold = exports.timesheetViewThreshold = void 0;
3
+ exports.timesheetEnterThreshold = exports.timesheetThreshold = exports.timesheetViewThreshold = void 0;
4
4
  exports.timesheetViewThreshold = "timesheetViewThreshold";
5
5
  exports.timesheetThreshold = "timesheetThreshold";
6
+ exports.timesheetEnterThreshold = "timesheetEnterThreshold";
@@ -5,11 +5,11 @@ export declare enum BankEntityKeysEnum {
5
5
  name = "name",
6
6
  accountNo = "accountNo",
7
7
  branchAddress = "branchAddress",
8
- micrCode = "micrCode",
9
8
  ifscCode = "ifscCode",
10
9
  emailForPaymentInfoCsv = "emailForPaymentInfoCsv",
11
10
  status = "status",
12
- remark = "remark"
11
+ remark = "remark",
12
+ swiftAddress = "swiftAddress"
13
13
  }
14
14
  export declare namespace BankEntityKeysEnum {
15
15
  const keyLabelMap: Record<BankEntityKeysEnum, string>;
@@ -11,11 +11,11 @@ var BankEntityKeysEnum;
11
11
  BankEntityKeysEnum["name"] = "name";
12
12
  BankEntityKeysEnum["accountNo"] = "accountNo";
13
13
  BankEntityKeysEnum["branchAddress"] = "branchAddress";
14
- BankEntityKeysEnum["micrCode"] = "micrCode";
15
14
  BankEntityKeysEnum["ifscCode"] = "ifscCode";
16
15
  BankEntityKeysEnum["emailForPaymentInfoCsv"] = "emailForPaymentInfoCsv";
17
16
  BankEntityKeysEnum["status"] = "status";
18
17
  BankEntityKeysEnum["remark"] = "remark";
18
+ BankEntityKeysEnum["swiftAddress"] = "swiftAddress";
19
19
  })(BankEntityKeysEnum || (exports.BankEntityKeysEnum = BankEntityKeysEnum = {}));
20
20
  (function (BankEntityKeysEnum) {
21
21
  BankEntityKeysEnum.keyLabelMap = {
@@ -25,11 +25,11 @@ var BankEntityKeysEnum;
25
25
  [BankEntityKeysEnum.name]: "Bank Name",
26
26
  [BankEntityKeysEnum.accountNo]: "Account Number",
27
27
  [BankEntityKeysEnum.branchAddress]: "Branch Address",
28
- [BankEntityKeysEnum.micrCode]: "MICR Code",
29
28
  [BankEntityKeysEnum.ifscCode]: "IFSC Code",
30
29
  [BankEntityKeysEnum.emailForPaymentInfoCsv]: "Email for Payment Info CSV",
31
30
  [BankEntityKeysEnum.status]: "Status",
32
31
  [BankEntityKeysEnum.remark]: "Remark",
32
+ [BankEntityKeysEnum.swiftAddress]: "Swift Address",
33
33
  };
34
34
  function getLabel(key) {
35
35
  if (!Object.values(BankEntityKeysEnum).includes(key)) {
@@ -62,7 +62,6 @@ export * from "./enums/work_from_entity_keys.enum";
62
62
  export * from "./interface/work_from_home.entity.interface";
63
63
  export * from "./interface/work_from_home_history.entity.interface";
64
64
  export * from "./interface/country.entity.interface";
65
- export * from "./enums/bank_type.enum";
66
65
  export * from "./enums/billing_invoice_type.enum";
67
66
  export * from "./interface/billing_timesheet.entity.interface";
68
67
  export * from "./interface/intermediary_bank.entity.interface";
@@ -79,7 +79,6 @@ __exportStar(require("./enums/work_from_entity_keys.enum"), exports);
79
79
  __exportStar(require("./interface/work_from_home.entity.interface"), exports);
80
80
  __exportStar(require("./interface/work_from_home_history.entity.interface"), exports);
81
81
  __exportStar(require("./interface/country.entity.interface"), exports);
82
- __exportStar(require("./enums/bank_type.enum"), exports);
83
82
  __exportStar(require("./enums/billing_invoice_type.enum"), exports);
84
83
  __exportStar(require("./interface/billing_timesheet.entity.interface"), exports);
85
84
  __exportStar(require("./interface/intermediary_bank.entity.interface"), exports);
@@ -1,9 +1,8 @@
1
- import { BankTypeEnum } from "../enums/bank_type.enum";
2
1
  import { BillingStatusEnum } from "../enums/billing.status.enum";
3
2
  import { BillingInvoiceTypeEnum } from "../enums/billing_invoice_type.enum";
4
3
  import { PaymentStatusEnum } from "../enums/payment_status.enum";
5
4
  import { IAuditColumnEntity } from "./audit-column.entity.interface";
6
- import { IEntityFilterData } from "./entity.utils.interface";
5
+ import { EntityEnum, IEntityFilterData } from "./entity.utils.interface";
7
6
  import { IProjectEntity } from "./project.entity.interface";
8
7
  import { ITimesheetEntity } from "./timesheet.entity.interface";
9
8
  export interface IBillingEntity extends IAuditColumnEntity {
@@ -25,7 +24,6 @@ export interface IBillingEntity extends IAuditColumnEntity {
25
24
  invoicePdfUrl?: string | null;
26
25
  invoiceContactName: string;
27
26
  bankId: number;
28
- bankType: BankTypeEnum;
29
27
  }
30
28
  export interface IBillingEntityFilterDto extends IEntityFilterData<IBillingEntity> {
31
29
  }
@@ -33,3 +31,5 @@ export interface IBillingEntityCreateDtoValidationData {
33
31
  projectEntity: IProjectEntity;
34
32
  timesheetEntities: ITimesheetEntity[];
35
33
  }
34
+ export declare const billingRelations: EntityEnum[];
35
+ export declare const billingEntities: EntityEnum[];
@@ -1,2 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.billingEntities = exports.billingRelations = void 0;
4
+ const entity_utils_interface_1 = require("./entity.utils.interface");
5
+ exports.billingRelations = [entity_utils_interface_1.EntityEnum.USER, entity_utils_interface_1.EntityEnum.PROJECT];
6
+ exports.billingEntities = [entity_utils_interface_1.EntityEnum.USER, entity_utils_interface_1.EntityEnum.PROJECT];
@@ -12,6 +12,18 @@ export type IApiEntity<T extends {
12
12
  }>;
13
13
  export type IEntityCreateDto<T> = Omit<T, "id" | keyof IAuditColumnEntity>;
14
14
  export type IEntityUpdateDto<T> = Omit<Partial<T>, "id" | keyof IAuditColumnEntity>;
15
+ export declare enum EntityEnum {
16
+ BILLING = "billing",
17
+ USER = "user",
18
+ PROJECT = "project",
19
+ CLIENT = "client",
20
+ TASK = "task",
21
+ DESIGNATION = "designation",
22
+ RATE = "rate"
23
+ }
24
+ export type ISearchIncludeEntity = {
25
+ name: EntityEnum;
26
+ };
15
27
  export type IEntityApiResponse<T extends {
16
28
  createdOn: Date;
17
29
  updatedOn: Date;
@@ -31,6 +43,8 @@ export type IEntityFilterData<T> = ConvertToArray<IEntityUpdateDto<T>> & {
31
43
  [key in keyof T]?: T[key];
32
44
  };
33
45
  [key: string]: any;
46
+ relations?: ISearchIncludeEntity[];
47
+ entities?: ISearchIncludeEntity[];
34
48
  };
35
49
  export type IEntityHistoryParsed = {
36
50
  parsedData: any;
@@ -1,2 +1,13 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.EntityEnum = void 0;
4
+ var EntityEnum;
5
+ (function (EntityEnum) {
6
+ EntityEnum["BILLING"] = "billing";
7
+ EntityEnum["USER"] = "user";
8
+ EntityEnum["PROJECT"] = "project";
9
+ EntityEnum["CLIENT"] = "client";
10
+ EntityEnum["TASK"] = "task";
11
+ EntityEnum["DESIGNATION"] = "designation";
12
+ EntityEnum["RATE"] = "rate";
13
+ })(EntityEnum || (exports.EntityEnum = EntityEnum = {}));
@@ -15,6 +15,7 @@ export interface IIntermediaryBankCreateDto extends Omit<IEntityCreateDto<IInter
15
15
  bankId?: number;
16
16
  }
17
17
  export interface IIntermediaryBankUpdateDto extends IEntityUpdateDto<IIntermediaryBankEntity> {
18
+ id?: number;
18
19
  }
19
20
  export interface IIntermediaryBankFilterDto extends IEntityFilterData<IIntermediaryBankEntity> {
20
21
  }
@@ -7,4 +7,5 @@ export declare enum CurrencyEnum {
7
7
  export declare namespace CurrencyEnum {
8
8
  function parse(value: string): CurrencyEnum;
9
9
  function getNames(): string[];
10
+ function getFullCurrencyName(currency: CurrencyEnum | string): string;
10
11
  }
@@ -23,15 +23,37 @@ var CurrencyEnum;
23
23
  return CurrencyEnum.GBP;
24
24
  default:
25
25
  throw new exceptions_1.AppBadRequestException({
26
- message: [`Invalid currency: '${value}'. Valid values are: ${CurrencyEnum.getNames().join(", ")}`],
26
+ message: [
27
+ `Invalid currency: '${value}'. Valid values are: ${CurrencyEnum.getNames().join(", ")}`,
28
+ ],
27
29
  key: error_key_enum_1.ErrorKeyEnum.CURRENCY,
28
30
  });
29
31
  }
30
32
  }
31
33
  CurrencyEnum.parse = parse;
32
34
  function getNames() {
33
- return Object.values(CurrencyEnum).filter(value => typeof value === 'string');
34
- ;
35
+ return Object.values(CurrencyEnum).filter((value) => typeof value === "string");
35
36
  }
36
37
  CurrencyEnum.getNames = getNames;
38
+ // Internal map
39
+ const CurrencyNameMap = {
40
+ USD: "United States Dollar",
41
+ INR: "Indian Rupees",
42
+ GBP: "British Sterling Pound",
43
+ EUR: "Euro",
44
+ };
45
+ // Public function to get full currency name
46
+ function getFullCurrencyName(currency) {
47
+ const name = CurrencyNameMap[currency];
48
+ if (!name) {
49
+ throw new exceptions_1.AppBadRequestException({
50
+ message: [
51
+ `Invalid currency for full name: '${currency}'. Valid values are: ${CurrencyEnum.getNames().join(", ")}`,
52
+ ],
53
+ key: error_key_enum_1.ErrorKeyEnum.CURRENCY,
54
+ });
55
+ }
56
+ return name;
57
+ }
58
+ CurrencyEnum.getFullCurrencyName = getFullCurrencyName;
37
59
  })(CurrencyEnum || (exports.CurrencyEnum = CurrencyEnum = {}));
@@ -8,5 +8,6 @@ export declare class DateCodeModel {
8
8
  static fromDate(date: Date): string;
9
9
  getFormattedDate(): string;
10
10
  getFormattedDateWithMonthName(): string;
11
+ static formatDateCode(dateCode: string): string;
11
12
  isWithinOffset(offsetInDays: number): boolean;
12
13
  }
@@ -52,6 +52,10 @@ class DateCodeModel {
52
52
  getFormattedDateWithMonthName() {
53
53
  return (0, date_fns_1.format)(this.getDate(), "dd-MMM-yyyy");
54
54
  }
55
+ static formatDateCode(dateCode) {
56
+ const parsedDate = (0, date_fns_1.parse)(dateCode, "yyyyMMdd", new Date());
57
+ return (0, date_fns_1.format)(parsedDate, "MMMM d, yyyy");
58
+ }
55
59
  isWithinOffset(offsetInDays) {
56
60
  const todaysDateModel = new DateCodeModel(DateCodeModel.fromDate(new Date()));
57
61
  const onTimeDateModel = todaysDateModel.getByOffset(offsetInDays);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "law-common",
3
- "version": "8.7.1-beta.0",
3
+ "version": "8.8.1-beta.0",
4
4
  "description": "",
5
5
  "main": "dist/index.js",
6
6
  "files": [
@@ -1,4 +0,0 @@
1
- export declare enum BankTypeEnum {
2
- INDIAN = "indian",
3
- FOREIGN = "foreign"
4
- }
@@ -1,8 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.BankTypeEnum = void 0;
4
- var BankTypeEnum;
5
- (function (BankTypeEnum) {
6
- BankTypeEnum["INDIAN"] = "indian";
7
- BankTypeEnum["FOREIGN"] = "foreign";
8
- })(BankTypeEnum || (exports.BankTypeEnum = BankTypeEnum = {}));