Skip to content

Commit 564c6ea

Browse files
committed
fix: Use defaultDatabaseItem for constructing default clothing/label/outfit to fix missing props errors
1 parent cc4153d commit 564c6ea

3 files changed

Lines changed: 11 additions & 14 deletions

File tree

src/app/pages/clothing/view.vue

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
* Created Date: 2025-09-08 15:39:55
66
* Author: 3urobeat
77
*
8-
* Last Modified: 2026-05-17 20:19:30
8+
* Last Modified: 2026-05-21 18:03:05
99
* Modified By: 3urobeat
1010
*
1111
* Copyright (c) 2025 - 2026 3urobeat <https://github.com/3urobeat>
@@ -163,7 +163,7 @@
163163
const storedCategories = getAllLabelCategoriesFromCache();
164164
165165
// Refs, init for new piece of clothing
166-
let storedClothing: Ref<ApiResponse<Clothing>> = ref({ success: true, message: null, document: { id: "", title: "", description: "", imgPath: "", labelIDs: [], addedTimestamp: 0, modifiedTimestamp: 0 } });
166+
let storedClothing: Ref<ApiResponse<Clothing>> = ref({ success: true, message: null, document: { ...defaultDatabaseItem, title: "", description: "", imgPath: "", labelIDs: [] } });
167167
let localClothing: Ref<ApiResponse<Clothing>> = storedClothing;
168168
169169
const currentImgPath = ref("");
@@ -262,13 +262,12 @@
262262
// If prompt was submitted with content
263263
if (name) {
264264
const newLabel: Label = {
265+
...defaultDatabaseItem,
265266
id: await getUUIDFromServer(),
266267
name: name,
267268
orderIndex: getNewLastLabelOrderIndex(getLabelsOfCategory(storedLabels.value.document!, thisCategory.id)),
268269
categoryID: thisCategory.id,
269-
specialityValue: CategorySpecialityMap[thisCategory.specialityID].value, // Init val
270-
addedTimestamp: 0,
271-
modifiedTimestamp: 0
270+
specialityValue: CategorySpecialityMap[thisCategory.specialityID].value // Init val
272271
};
273272
274273
// Send new label to server

src/app/pages/labels/index.vue

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
* Created Date: 2025-09-09 17:13:32
66
* Author: 3urobeat
77
*
8-
* Last Modified: 2026-05-12 19:49:24
8+
* Last Modified: 2026-05-21 18:03:07
99
* Modified By: 3urobeat
1010
*
1111
* Copyright (c) 2025 - 2026 3urobeat <https://github.com/3urobeat>
@@ -228,13 +228,12 @@
228228
// Add a new label to a category
229229
async function addLabel(category: Category) {
230230
const newLabel: Label = {
231+
...defaultDatabaseItem,
231232
id: await getUUIDFromServer(),
232233
name: "",
233234
orderIndex: getNewLastLabelOrderIndex(labelsPerCategory[category.id]!),
234235
categoryID: category.id,
235-
specialityValue: CategorySpecialityMap[category.specialityID].value, // Init val
236-
addedTimestamp: 0,
237-
modifiedTimestamp: 0
236+
specialityValue: CategorySpecialityMap[category.specialityID].value // Init val
238237
};
239238
240239
localLabels.value.push(newLabel);
@@ -291,11 +290,10 @@
291290
// Add a new category
292291
async function addCategory() {
293292
const e: Category = {
293+
...defaultDatabaseItem,
294294
id: await getUUIDFromServer(),
295295
name: "",
296-
specialityID: CategorySpecialityID.No_Speciality,
297-
addedTimestamp: 0,
298-
modifiedTimestamp: 0
296+
specialityID: CategorySpecialityID.No_Speciality
299297
};
300298
301299
localCategories.value.push(e);

src/app/pages/outfits/view.vue

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
* Created Date: 2025-09-10 17:37:07
66
* Author: 3urobeat
77
*
8-
* Last Modified: 2026-05-12 19:49:24
8+
* Last Modified: 2026-05-21 18:03:10
99
* Modified By: 3urobeat
1010
*
1111
* Copyright (c) 2025 - 2026 3urobeat <https://github.com/3urobeat>
@@ -240,7 +240,7 @@
240240
const storedCategories = getAllLabelCategoriesFromCache();
241241
242242
// Refs, init for new outfit
243-
let storedOutfit: Ref<ApiResponse<Outfit>> = ref({ success: true, message: null, document: { id: "", title: "", clothes: [], labelIDs: [], previewImgPath: "", addedTimestamp: 0, modifiedTimestamp: 0 } });
243+
let storedOutfit: Ref<ApiResponse<Outfit>> = ref({ success: true, message: null, document: { ...defaultDatabaseItem, title: "", clothes: [], labelIDs: [], previewImgPath: "" } });
244244
let localOutfit: Ref<ApiResponse<Outfit>> = storedOutfit;
245245
const bodyPartLabels: Ref<Label[]> = ref([]);
246246
await getAllClothesFromServer();

0 commit comments

Comments
 (0)