Open AmirhosseinOlyaei opened 7 months ago
const mongoose = require('mongoose')
const UserSchema = new mongoose.Schema({ id: { "type": "ObjectId", "required": true }, username: { "type": "String", "required": true }, email: { "type": "String", "required": true }, phone: { "type": "String", "required": true }, location: { type: { type: String }, coordinates: [Number] }, preferredExchangeMethod: { "type": "String", "required": true }, ratings: [ { stars: {"type": "Number", "required": true }, review: { "type": "String", "required": true } } ] } );
module.exports = mongoose.model('Toy',UserSchema)
/ User Profile Management Location Email Phone number Preferred way of exchange ( pickup/drop off) rating (star system + review ) /
/* models
// schema design to store information about users like name, geographic location const userSchema = new mongoose.Schema({ name: { first: String, last: String }, // GeoJSON is a format for storing geographic points and polygons. location: { type: { type: String, enum: ['Point'], required: true }, coordinates: { type: [Number], required: true } }, exchangeMethod: { type: String, enum: ['pickup', 'drop-off'], required: true } })
//schema representing rating (star system + review ) const reviewSchema = mongoose.Schema( {
rating: {
type: Number,
required: true
},
comment: {
type: String,
required: true
},
addedBy: {
type: mongoose.Schema.Types.ObjectId,
required: true,
ref: 'User'
}
}
)
/ Ability for users to post toys that they want to exchange. description picture(s) of toys rating (star system + review ) age / range method of pickup each post has a status /stage that the user can manage user should have the ability to edit a post /
const toySchema = mongoose.Schema({ user: { type: mongoose.Schema.Types.ObjectId, required: true, ref: "User", }, toyName: { type: String, required: true, }, toyImage: { type: String, required: true, }, toyDescription: { type: String, required: true, }, exchangeMethod: { type: String, enum: ["pickup", "drop-off"], required: true, }, });
@morarodgers @betielamanuel Please find the updated information regarding what we need to capture in the application along with the routes that will need to be created. If you have questions please ask thank you :
Front End Default route: listing listingdetail login userprofile messages createlisting
https://github.com/Code-the-Dream-School/ffprac-team4-back/pull/15 please follow this link to see the changes made
const mongoose = require('mongoose')
const ToySchema = new mongoose.Schema({ id: { "type": "ObjectId", "required": true }, userId: { "type": "ObjectId", "required": true }, description: { "type": "String", "required": true }, pictures: { "type": ["String"], "required": true }, ageRange: { "type": "String", "required": true }, methodOfPickup: { "type": "String", "required": true }, status: { "type": "String", "required": true }, ratings: [ { "stars": { "type": "Number", "required": true }, "review": { "type": "String", "required": true } } ] } );