removed metadata from condition check model

This commit is contained in:
jackiettran
2025-11-25 16:48:54 -05:00
parent 8de814fdee
commit 2983f67ce8
6 changed files with 72 additions and 28 deletions

View File

@@ -118,7 +118,6 @@ class ConditionCheckService {
* @param {string} userId - User submitting the check
* @param {Array} photos - Array of photo URLs
* @param {string} notes - Optional notes
* @param {Object} metadata - Additional metadata (device info, location, etc.)
* @returns {Object} - Created condition check
*/
static async submitConditionCheck(
@@ -126,8 +125,7 @@ class ConditionCheckService {
checkType,
userId,
photos = [],
notes = null,
metadata = {}
notes = null
) {
// Validate the check
const validation = await this.validateConditionCheck(
@@ -145,22 +143,12 @@ class ConditionCheckService {
throw new Error("Maximum 20 photos allowed per condition check");
}
// Add timestamp and user agent to metadata
const enrichedMetadata = {
...metadata,
submittedAt: new Date().toISOString(),
userAgent: metadata.userAgent || "Unknown",
ipAddress: metadata.ipAddress || "Unknown",
deviceType: metadata.deviceType || "Unknown",
};
const conditionCheck = await ConditionCheck.create({
rentalId,
checkType,
submittedBy: userId,
photos,
notes,
metadata: enrichedMetadata,
});
return conditionCheck;