mirror of
https://github.com/myfatemi04/wheelshare-old-backend.git
synced 2025-04-21 12:10:17 -04:00
update Pool model
This commit is contained in:
parent
f3ae54ffc4
commit
4947d68bb1
|
@ -10,6 +10,8 @@ router.post('/:poolID/comment', requireApiAuth, async (req, res) => {
|
||||||
const poolID = req.params.poolID;
|
const poolID = req.params.poolID;
|
||||||
const commentBody = req.body.body;
|
const commentBody = req.body.body;
|
||||||
|
|
||||||
|
console.log(req.body);
|
||||||
|
|
||||||
await PoolModel.updateOne(
|
await PoolModel.updateOne(
|
||||||
{ _id: poolID },
|
{ _id: poolID },
|
||||||
{
|
{
|
||||||
|
@ -17,6 +19,7 @@ router.post('/:poolID/comment', requireApiAuth, async (req, res) => {
|
||||||
comments: {
|
comments: {
|
||||||
author_id: userID,
|
author_id: userID,
|
||||||
body: commentBody,
|
body: commentBody,
|
||||||
|
created_at: new Date().toISOString(),
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
|
@ -15,6 +15,7 @@ export interface Group extends Document {
|
||||||
export interface Comment {
|
export interface Comment {
|
||||||
body: string;
|
body: string;
|
||||||
author_id: string;
|
author_id: string;
|
||||||
|
created_at: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
const UserSchema: Schema = new Schema({
|
const UserSchema: Schema = new Schema({
|
||||||
|
@ -39,8 +40,9 @@ const GroupSchema: Schema = new Schema({
|
||||||
const GroupModel: Model<Group> = model('Group', GroupSchema);
|
const GroupModel: Model<Group> = model('Group', GroupSchema);
|
||||||
|
|
||||||
const CommentSchema: Schema = new Schema({
|
const CommentSchema: Schema = new Schema({
|
||||||
text: { type: String, required: true },
|
body: { type: String, required: true },
|
||||||
author_id: { type: String, required: true },
|
author_id: { type: String, required: true },
|
||||||
|
created_at: { type: String, required: true },
|
||||||
});
|
});
|
||||||
|
|
||||||
const CommentModel = model('Comment', CommentSchema);
|
const CommentModel = model('Comment', CommentSchema);
|
||||||
|
|
Loading…
Reference in New Issue
Block a user