rez_core 6.5.74 → 6.5.75

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": "6.5.74",
3
+ "version": "6.5.75",
4
4
  "description": "",
5
5
  "author": "",
6
6
  "private": false,
@@ -23,6 +23,7 @@ export class ListMasterItemsRepository {
23
23
  async findItemsByType(
24
24
  type: string,
25
25
  sort_by?,
26
+ storage_type?,
26
27
  inactiveIdsArray?: number[],
27
28
  enterprise_id?: number,
28
29
  params?: Record<string, string>,
@@ -79,9 +80,10 @@ export class ListMasterItemsRepository {
79
80
  order: orderBy,
80
81
  });
81
82
 
83
+
82
84
  let result = items.map((i) => ({
83
85
  label: i.name,
84
- value: i.id,
86
+ value: storage_type === 'code' ? i.code : parseInt(String(i.id), 10),
85
87
  }));
86
88
 
87
89
  // Handle inactive items if specified
@@ -127,6 +127,21 @@ export class ListMasterItemService extends EntityServiceImpl {
127
127
 
128
128
  const finalCode = code || ''; // Could generate code here if needed
129
129
 
130
+ // Check if code already exists (if code is provided)
131
+ if (finalCode) {
132
+ const codeExists = await this.listItemsRepo.findOneByCondition({
133
+ code: finalCode,
134
+ listtype: listType,
135
+ enterprise_id: entId,
136
+ });
137
+
138
+ if (codeExists) {
139
+ throw new BadRequestException(
140
+ `list item with code ${finalCode} already exists`,
141
+ );
142
+ }
143
+ }
144
+
130
145
  await this.createEntity(
131
146
  {
132
147
  ...item,
@@ -124,6 +124,7 @@ export class ListMasterService {
124
124
  return this.listItemsRepo.findItemsByType(
125
125
  type,
126
126
  config.sort_by,
127
+ config.storage_type,
127
128
  inactiveIdsArray,
128
129
  loggedInUser?.enterprise_id,
129
130
  params,
@@ -586,6 +587,7 @@ export class ListMasterService {
586
587
  return this.listItemsRepo.findItemsByType(
587
588
  lmCode,
588
589
  listMaster.sort_by,
590
+ listMaster.storage_type,
589
591
  inactiveIdsArray,
590
592
  loggedInUser.enterprise_id,
591
593
  params,