pristine-member-nest-api-database 1.0.59 → 1.0.60

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.
@@ -30,7 +30,7 @@ const fieldSchema = new mongoose_1.Schema({
30
30
  fieldName: { type: String },
31
31
  FieldTypeId: {
32
32
  type: mongoose_1.Schema.Types.ObjectId,
33
- ref: "Field.Types", // Reference to the 'Container' model
33
+ ref: "Field.Types", // Reference to the 'field Types' model
34
34
  required: false,
35
35
  default: null,
36
36
  },
@@ -69,10 +69,6 @@ const fieldTypeSchema = new mongoose_1.Schema({
69
69
  type: String,
70
70
  trim: true,
71
71
  },
72
- config: {
73
- type: mongoose_1.Schema.Types.Mixed,
74
- default: {},
75
- },
76
72
  isSystemDefined: {
77
73
  type: Boolean,
78
74
  default: false,
@@ -1,5 +1,89 @@
1
1
  import mongoose, { Document, Schema } from "mongoose";
2
2
  import { Audit } from "../interface/Audit.interface";
3
+ import { FieldTypeEnum } from "./FieldTypes.model";
4
+
5
+ // TEXT
6
+ export interface TextFieldConfig {
7
+ pattern?: string | null; // regex pattern for validation
8
+ minLength?: number | null;
9
+ maxLength?: number | null;
10
+ }
11
+
12
+ //decimal ```NUMBER
13
+ export interface DecimalNumberFieldConfig {
14
+ step?: number; // for decimals
15
+ pattern?: string; // regex pattern for validation
16
+ minLength?: number | null;
17
+ maxLength?: number | null;
18
+ }
19
+
20
+ //whole number ```NUMBER
21
+ export interface WholeNumberFieldConfig {
22
+ pattern?: string; // regex pattern for validation
23
+ minLength?: number | null;
24
+ maxLength?: number | null;
25
+ }
26
+
27
+ // OPTIONS (checkbox / dropdown)
28
+ export interface OptionConfig {
29
+ value: string;
30
+ label: string;
31
+ }
32
+
33
+ export interface OptionFieldConfig {
34
+ options?: OptionConfig[];
35
+ allowMultiple?: boolean;
36
+ referenceCollection?: string;
37
+ }
38
+
39
+ // TABLE
40
+ export interface TableColumn {
41
+ columnId: string;
42
+ label: string;
43
+ type: FieldTypeEnum;
44
+ required?: boolean;
45
+ referenceCollection?: string;
46
+ }
47
+
48
+ // MATRIX
49
+ export interface MatrixRow {
50
+ rowId: string;
51
+ label: string;
52
+ type: FieldTypeEnum;
53
+ required?: boolean;
54
+ referenceCollection?: string;
55
+ }
56
+
57
+ export interface MatrixColumn {
58
+ columnId: string;
59
+ label: string;
60
+ type: FieldTypeEnum;
61
+ required?: boolean;
62
+ referenceCollection?: string;
63
+ }
64
+
65
+ export interface TableFieldConfig {
66
+ columns: TableColumn[];
67
+ minRows?: number;
68
+ maxRows?: number;
69
+ }
70
+
71
+ export interface MatrixFieldConfig {
72
+ rows: MatrixRow[];
73
+ columns: MatrixColumn[];
74
+ }
75
+
76
+ /* =========================
77
+ UNION CONFIG TYPE
78
+ ========================= */
79
+ export type FieldConfig =
80
+ | TextFieldConfig
81
+ | WholeNumberFieldConfig
82
+ | DecimalNumberFieldConfig
83
+ | OptionFieldConfig
84
+ | TableFieldConfig
85
+ | MatrixFieldConfig
86
+ | null;
3
87
 
4
88
  interface EditorField extends Document {
5
89
  fieldCode: string;
@@ -9,13 +93,8 @@ interface EditorField extends Document {
9
93
  SapSync: boolean;
10
94
  MemberEdit: boolean;
11
95
  ManagerEdit: boolean;
12
- fieldConfig?: {
13
- mandatory: boolean;
14
- minLength?: number | null;
15
- maxLength?: number | null;
16
- pattern?: string | null;
17
- };
18
-
96
+ mandatory: boolean;
97
+ fieldConfig: FieldConfig;
19
98
  isActive: boolean;
20
99
  audit: Audit[];
21
100
  }
@@ -25,7 +104,7 @@ const fieldSchema = new Schema<EditorField>({
25
104
  fieldName: { type: String },
26
105
  FieldTypeId: {
27
106
  type: Schema.Types.ObjectId,
28
- ref: "Field.Types", // Reference to the 'Container' model
107
+ ref: "Field.Types", // Reference to the 'field Types' model
29
108
  required: false,
30
109
  default: null,
31
110
  },
@@ -26,82 +26,6 @@ export enum FieldTypeEnum {
26
26
  CONFIG INTERFACES
27
27
  ========================= */
28
28
 
29
- // TEXT
30
- export interface TextFieldConfig {
31
- pattern?: string | null; // regex pattern for validation
32
- }
33
-
34
- //decimal ```NUMBER
35
- export interface DecimalNumberFieldConfig {
36
- step?: number; // for decimals
37
- pattern?: string; // regex pattern for validation
38
- }
39
-
40
- //whole number ```NUMBER
41
- export interface WholeNumberFieldConfig {
42
- pattern?: string; // regex pattern for validation
43
- }
44
-
45
- // OPTIONS (checkbox / dropdown)
46
- export interface OptionConfig {
47
- value: string;
48
- label: string;
49
- }
50
-
51
- export interface OptionFieldConfig {
52
- options: OptionConfig[];
53
- allowMultiple?: boolean;
54
- }
55
-
56
- // TABLE
57
- export interface TableColumn {
58
- columnId: string;
59
- label: string;
60
- type: FieldTypeEnum;
61
- required?: boolean;
62
- referenceCollection?: string;
63
- }
64
-
65
- // MATRIX
66
- export interface MatrixRow {
67
- rowId: string;
68
- label: string;
69
- type: FieldTypeEnum;
70
- required?: boolean;
71
- referenceCollection?: string;
72
- }
73
-
74
- export interface MatrixColumn {
75
- columnId: string;
76
- label: string;
77
- type: FieldTypeEnum;
78
- required?: boolean;
79
- referenceCollection?: string;
80
- }
81
-
82
- export interface TableFieldConfig {
83
- columns: TableColumn[];
84
- minRows?: number;
85
- maxRows?: number;
86
- }
87
-
88
- export interface MatrixFieldConfig {
89
- rows: MatrixRow[];
90
- columns: MatrixColumn[];
91
- }
92
-
93
- /* =========================
94
- UNION CONFIG TYPE
95
- ========================= */
96
- export type FieldConfig =
97
- | TextFieldConfig
98
- | WholeNumberFieldConfig
99
- | DecimalNumberFieldConfig
100
- | OptionFieldConfig
101
- | TableFieldConfig
102
- | MatrixFieldConfig
103
- | null;
104
-
105
29
  /* =========================
106
30
  MAIN DOCUMENT INTERFACE
107
31
  ========================= */
@@ -110,7 +34,6 @@ export interface EditorFieldType extends Document {
110
34
  fieldEnum: FieldTypeEnum; // holds enum value
111
35
  fieldTypeName: string;
112
36
  fieldTypeDescription?: string;
113
- config: FieldConfig;
114
37
  isSystemDefined: boolean;
115
38
  isActive: boolean;
116
39
  audit: Audit[];
@@ -144,11 +67,6 @@ const fieldTypeSchema = new Schema<EditorFieldType>(
144
67
  trim: true,
145
68
  },
146
69
 
147
- config: {
148
- type: Schema.Types.Mixed,
149
- default: {},
150
- },
151
-
152
70
  isSystemDefined: {
153
71
  type: Boolean,
154
72
  default: false,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pristine-member-nest-api-database",
3
- "version": "1.0.59",
3
+ "version": "1.0.60",
4
4
  "description": "application verification database changes with gs1 branch. not tested. ",
5
5
  "main": "dist/index.js",
6
6
  "scripts": {