Implemented stock locations.
Some checks failed
farmcontrol/farmcontrol-ws/pipeline/head There was a failure building this commit
Some checks failed
farmcontrol/farmcontrol-ws/pipeline/head There was a failure building this commit
This commit is contained in:
parent
ca3f28fc74
commit
c38c1dee24
@ -2,11 +2,21 @@ import mongoose from 'mongoose';
|
||||
import { generateId } from '../../utils.js';
|
||||
const { Schema } = mongoose;
|
||||
|
||||
const addressSchema = new Schema({
|
||||
building: { required: false, type: String },
|
||||
addressLine1: { required: false, type: String },
|
||||
addressLine2: { required: false, type: String },
|
||||
city: { required: false, type: String },
|
||||
state: { required: false, type: String },
|
||||
postcode: { required: false, type: String },
|
||||
country: { required: false, type: String },
|
||||
});
|
||||
|
||||
const stockLocationSchema = new Schema(
|
||||
{
|
||||
_reference: { type: String, default: () => generateId()() },
|
||||
name: { type: String, required: true },
|
||||
notes: { type: String, required: false },
|
||||
address: { required: false, type: addressSchema },
|
||||
},
|
||||
{ timestamps: true }
|
||||
);
|
||||
|
||||
@ -56,6 +56,8 @@ const hostSchema = new mongoose.Schema(
|
||||
connectedAt: { required: false, type: Date },
|
||||
authCode: { type: { required: false, type: String } },
|
||||
deviceInfo: { deviceInfoSchema },
|
||||
otp: { type: { required: false, type: String } },
|
||||
otpExpiresAt: { required: false, type: Date },
|
||||
files: [{ type: mongoose.Schema.Types.ObjectId, ref: 'file' }],
|
||||
},
|
||||
{ timestamps: true }
|
||||
|
||||
@ -6,6 +6,8 @@ const listingSchema = new Schema(
|
||||
{
|
||||
_reference: { type: String, default: () => generateId()() },
|
||||
product: { type: Schema.Types.ObjectId, ref: 'product', required: false },
|
||||
vendor: { type: Schema.Types.ObjectId, ref: 'vendor', required: true },
|
||||
stockLocation: { type: Schema.Types.ObjectId, ref: 'stockLocation', required: true },
|
||||
marketplace: { type: Schema.Types.ObjectId, ref: 'marketplace', required: true },
|
||||
title: { type: String, required: false },
|
||||
state: {
|
||||
|
||||
@ -23,9 +23,12 @@ export async function generateHostOTP(id) {
|
||||
const otpHost = await editObject({
|
||||
model: hostModel,
|
||||
id: id,
|
||||
updateData: { otp: otp, otpExpiresAt: expiresAt }
|
||||
updateData: { otp: otp, otpExpiresAt: expiresAt },
|
||||
auditLog: false
|
||||
});
|
||||
|
||||
console.log('otpHost', otpHost);
|
||||
|
||||
return otpHost;
|
||||
}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user