Fix product assignment for users in different stores to ensure correct placement

Implement backend logic to ensure correct product group assignment, resolving an issue where products were incorrectly placed in the wrong store due to missing group ID data from the frontend, and add detailed logging for better debugging.

Replit-Commit-Author: Agent
Replit-Commit-Session-Id: b163d4c0-de5e-4f4e-a9c0-aed4c7049718
Replit-Commit-Checkpoint-Type: full_checkpoint
Replit-Commit-Screenshot-Url: https://storage.googleapis.com/screenshot-production-us-central1/1957c339-2757-4d1f-8e92-e9f71a1ce58e/b163d4c0-de5e-4f4e-a9c0-aed4c7049718/PoPN0Ru
This commit is contained in:
michaelschal committed 2025-08-12 15:00:29 +00:00
1 parent 9f53d7b296
commit 00e3c98550
6 files changed
+124 -5

No files matched your search

+6 -2
View File
@@ -214,11 +214,15 @@ export default function DlcPage() {
groupId = 1;
}
console.log("🏪 DLC GroupId Selection:", {
console.log("🏪 DLC GroupId Selection DEBUG:", {
userRole: user?.role,
selectedStoreId,
userGroups: user?.userGroups?.map(ug => ({groupId: ug.groupId, groupName: ug.group?.name})),
finalGroupId: groupId
availableStores: stores.map(s => ({id: s.id, name: s.name})),
userGroupsRaw: user?.userGroups,
firstUserGroup: user?.userGroups?.[0],
finalGroupId: groupId,
logicPath: !groupId ? 'need-fallback' : 'already-set'
});
const dlcData: InsertDlcProduct = {