@futdevpro/nts-dynamo 1.5.53 → 1.5.55

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.
@@ -23,23 +23,23 @@ export declare class DynamoNTS_DataService<T extends Dynamo_Metadata> {
23
23
  dataDBService: DynamoNTS_DBService<T>;
24
24
  data: T;
25
25
  dataList: T[];
26
- issuer?: string;
26
+ issuer: string;
27
27
  depKey?: string;
28
28
  depDBServiceKey?: string;
29
29
  private depDataDBService;
30
30
  dataParams: DynamoNTS_DataParams;
31
31
  defaultErrorUserMsg: string;
32
32
  defaultValidationErrorUserMsg: string;
33
- constructor(data: T, dataParams: DynamoNTS_DataParams, issuer?: string);
33
+ constructor(data: T, dataParams: DynamoNTS_DataParams, issuer: string);
34
34
  /**
35
35
  * returns all data from database to service dataList
36
36
  */
37
- getAll(): Promise<void>;
37
+ getAll(dontSetToService?: boolean): Promise<T[]>;
38
38
  /**
39
39
  * @description
40
40
  * returns data from database by id
41
41
  * also if dontSetToService is false or not setted,
42
- * the data will be saved to the service
42
+ * the data will be saved to the service, even if its not found
43
43
  *
44
44
  * @remarks
45
45
  * If you need to get-save a data, if possible,
@@ -60,11 +60,124 @@ export declare class DynamoNTS_DataService<T extends Dynamo_Metadata> {
60
60
  * returns dataList from database by dependencyId to the service
61
61
  * @param dependencyId
62
62
  */
63
- getDataListByDependencyId(dependencyId?: string): Promise<void>;
63
+ getDataListByDependencyId(dependencyId?: string, dontSetToService?: boolean): Promise<T[]>;
64
+ /**
65
+ *
66
+ * // findOne desc:
67
+ *
68
+ * Find the data first by any of its parameters,
69
+ * also if dontSetToService is false or not setted,
70
+ * the data will be saved to the service, even if non found
71
+ *
72
+ * @param filter if you can, use unique parameters for find!
73
+ *
74
+ * @example
75
+ * // by email:
76
+ * { email: email }
77
+ * //
78
+ * @example
79
+ * // or by id that is in list:
80
+ * { userIds: { $in: this.userId } }
81
+ * //
82
+ * @example
83
+ * // or by number or Date that is Greater Than AND Less Than:
84
+ * { points: { $gt: 2, $lt: 14 } }
85
+ * // further tools (syntax matches with $gt):
86
+ * $eq: // Matches values that are EQual to a specified value.
87
+ * $gte: // Matches values that are Greater Than OR Equal to a specified value.
88
+ * $lte: // Matches values that are Less Than or Equal to a specified value.
89
+ * $ne: // Matches all values that are Not Equal to a specified value.
90
+ * $nin: // Matches None of the values specified IN an array.
91
+ * //
92
+ * @returns {T} data: T
93
+ */
94
+ findData(findBy: any, dontSetToService?: boolean): Promise<T>;
95
+ /**
96
+ *
97
+ * // find desc:
98
+ *
99
+ * Find the data first by any of its parameters,
100
+ * also if dontSetToService is false or not setted,
101
+ * the data will be saved to the service, even if non found
102
+ *
103
+ * @param filter if you can, use unique parameters for find!
104
+ *
105
+ * @example
106
+ * // by email:
107
+ * { email: email }
108
+ * //
109
+ * @example
110
+ * // or by id that is in list:
111
+ * { userIds: { $in: this.userId } }
112
+ * //
113
+ * @example
114
+ * // or by number or Date that is Greater Than AND Less Than:
115
+ * { points: { $gt: 2, $lt: 14 } }
116
+ * // further tools (syntax matches with $gt):
117
+ * $eq: // Matches values that are EQual to a specified value.
118
+ * $gte: // Matches values that are Greater Than OR Equal to a specified value.
119
+ * $lte: // Matches values that are Less Than or Equal to a specified value.
120
+ * $ne: // Matches all values that are Not Equal to a specified value.
121
+ * $nin: // Matches None of the values specified IN an array.
122
+ * //
123
+ * @returns {T[]} dataList: T[]
124
+ */
125
+ findDatas(findBy: any, dontSetToService?: boolean): Promise<T[]>;
64
126
  /**
65
127
  * This function uses the dataDBService.updateOne function.
66
128
  * This uses updateBy if setted, or data._id if its setted or this.data[this.dependencyKey]
67
129
  * @param set
130
+ *
131
+ * // updateOne desc:
132
+ *
133
+ * Find the data first by any of its parameters, throws error if not found
134
+ * @param filter This uses the basic Mongoose updateOne.
135
+ * If you can, use unique parameters for find!
136
+ * @example
137
+ * // by email:
138
+ * { email: email }
139
+ * //
140
+ * @example
141
+ * // or by id that is in list:
142
+ * { userIds: { $in: this.userId } }
143
+ * //
144
+ * @example
145
+ * // or by number or Date that is Greater Than AND Less Than:
146
+ * { points: { $gt: 2, $lt: 14 } }
147
+ * // further tools (syntax matches with $gt):
148
+ * $eq: // Matches values that are EQual to a specified value.
149
+ * $gte: // Matches values that are Greater Than OR Equal to a specified value.
150
+ * $lte: // Matches values that are Less Than or Equal to a specified value.
151
+ * $ne: // Matches all values that are Not Equal to a specified value.
152
+ * $nin: // Matches None of the values specified IN an array.
153
+ * //
154
+ *
155
+ * @param update this uses the basic Mongoose updateOne
156
+ * @example
157
+ * // increase a specific value (here by 15):
158
+ * { $inc: { popularity: 15 } }
159
+ * //
160
+ * @example
161
+ * // or add element to a list:
162
+ * { $push: { reactions: this.newReaction }
163
+ * // or add multiple elements to a list
164
+ * { $push: { schedule: {$each: [ monday, tuesday, wednesday ] } } }
165
+ * //
166
+ * @example
167
+ * // or all at once
168
+ * {
169
+ * $inc: { popularity: this.newVote.amount },
170
+ * emailVerified: true,
171
+ * $push: { reactions: this.newReaction }
172
+ * }
173
+ * // further tools (syntax matches with $inc):
174
+ * $currentDate: // Sets the value of a field to current date, either as a Date or a Timestamp.
175
+ * $min: // Only updates the field if the specified value is less than the existing field value.
176
+ * $max: // Only updates the field if the specified value is greater than the existing field value.
177
+ * $mul: // Multiplies the value of the field by the specified amount.
178
+ * $rename: // Renames a field.
179
+ * $unset: // Removes the specified field from a document. (set: "" to value)
180
+ * //
68
181
  */
69
182
  updateData(set: {
70
183
  updateBy?: any;
@@ -74,6 +187,7 @@ export declare class DynamoNTS_DataService<T extends Dynamo_Metadata> {
74
187
  * modifies data if the data have ID and already exists in the DB,
75
188
  * creates new if the ID is not present or cant find in DB,
76
189
  * and if dependency data setted up, will check before creation,
190
+ *
77
191
  * @warning
78
192
  * but the proper way to update data, if you use update method instead,
79
193
  * this way, you can avoid data override errors
@@ -1 +1 @@
1
- {"version":3,"file":"dynamo-nts-data.service.d.ts","sourceRoot":"","sources":["../../src/_services/dynamo-nts-data.service.ts"],"names":[],"m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