Skip to content

Commit

Permalink
sdas
Browse files Browse the repository at this point in the history
  • Loading branch information
polroti committed Mar 16, 2024
1 parent b360fe6 commit e583da1
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 4 deletions.
13 changes: 12 additions & 1 deletion components/places/controller/transitNodeController.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
const mongoose = require("mongoose");
const TransiteNode = require("../models/transitnode");
const TransiteNode = require("../models/TransitNode");

exports.createTransiteNode = (req, res, next) => {
const { name_en, name_ta, name_si, type, address, isStartOrEndNode, province } =
Expand Down Expand Up @@ -82,6 +82,17 @@ exports.checkIfTransitNodeExistsByPlaceId = (req, res, next) => {
});
};

exports.updateTransitNode = (req, res, next) =>{
TransiteNode.findOne({
place_id: req.params.place_id
}).exec().then((foundOne)=>{
if(foundOne){

}
})
}

//warning! only for dev purposes
exports.deleteAllTransitNodes = (req, res, next) =>{
TransiteNode.deleteMany().exec().then(()=>{
res.status(200).json({
Expand Down
6 changes: 3 additions & 3 deletions components/places/models/transitnode.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
const mongoose = require("mongoose");
const Schema = mongoose.Schema;

const transitNodeSchema = Schema({
const TransitNodeSchema = Schema({
_id: mongoose.Schema.Types.ObjectId,
place_id: {
type: String,
required: true,
unique: true,
maxLength: 10
maxlength: 10
},
name_en: {
type: String,
Expand Down Expand Up @@ -42,4 +42,4 @@ const transitNodeSchema = Schema({

});

module.exports = mongoose.model('TransitNode',transitNodeSchema);
module.exports = mongoose.model('TransitNode',TransitNodeSchema);

0 comments on commit e583da1

Please sign in to comment.