rez_core 2.2.77 → 2.2.79

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "rez_core",
3
- "version": "2.2.77",
3
+ "version": "2.2.79",
4
4
  "description": "",
5
5
  "author": "",
6
6
  "private": false,
@@ -29,7 +29,7 @@ export class ListMasterRepository {
29
29
  .createQueryBuilder('item')
30
30
  .where('item.source = :source', { source: 'master' })
31
31
  .andWhere('item.organization_id = :organizationId', { organizationId })
32
- .andWhere('item.is_factory = :isFactory', { isFactory: false });
32
+ // .andWhere('item.is_factory = :isFactory', { isFactory: false });
33
33
 
34
34
  if (search?.trim()) {
35
35
  qb.andWhere(
@@ -21,15 +21,12 @@ export class FormMasterRepository {
21
21
  ) {}
22
22
 
23
23
  async getForms(organization_id: number, source_entity_type: string) {
24
- const forms = await this.dataSource
25
- .createQueryBuilder()
26
- .select(['fm.id', 'fm.form_name'])
27
- .from('cr_form_master', 'fm')
28
- // .where('fm.organization_id = :orgId', { orgId: organization_id })
29
- .where('fm.source_entity_type = :sourceEntityType', {
30
- sourceEntityType: source_entity_type,
31
- })
32
- .getRawMany();
24
+ const forms = await this.dataSource.query(
25
+ `SELECT fm.id as fm_id, fm.name as fm_form_name
26
+ FROM cr_view_master fm
27
+ WHERE fm.organization_id = ? AND fm.mapped_entity_type = ?`,
28
+ [organization_id, source_entity_type],
29
+ );
33
30
 
34
31
  const formatted = forms.map((form: any) => ({
35
32
  label: form.fm_form_name,
@@ -189,7 +189,6 @@ export class TaskService extends EntityServiceImpl {
189
189
  whereClauses.push(`t.is_mandatory = ?`);
190
190
  params.push(mandatory ? 1 : 0);
191
191
  }
192
-
193
192
  if (overdue) {
194
193
  whereClauses.push(
195
194
  `(t.due_date < CURDATE() OR (t.due_date = CURDATE() AND t.due_time < CURTIME()))`,
@@ -219,6 +218,31 @@ export class TaskService extends EntityServiceImpl {
219
218
 
220
219
  const taskData = await this.dataSource.query(sql, params);
221
220
 
221
+ // Loop through each task and resolve task_status
222
+ for (const task of taskData) {
223
+ if (!task.status) {
224
+ task.task_status = null;
225
+ continue;
226
+ }
227
+
228
+ const taskStatusQuery = `
229
+ SELECT name
230
+ FROM cr_list_master_items
231
+ WHERE id = ?
232
+ AND organization_id = ?
233
+ AND listtype = 'TKST'
234
+ LIMIT 1;
235
+ `;
236
+
237
+ const [statusRow] = await this.dataSource.query(taskStatusQuery, [
238
+ task.status,
239
+ loggedInUser.organization_id,
240
+ ]);
241
+
242
+ task.task_status = statusRow?.name || null;
243
+ }
244
+
245
+ // Normalize is_mandatory to '0'/'1' as string
222
246
  return taskData.map((task) => ({
223
247
  ...task,
224
248
  is_mandatory: task.is_mandatory ? '1' : '0',