Skip to content

Commit

Permalink
moved around some files
Browse files Browse the repository at this point in the history
  • Loading branch information
reinatakahara committed Jan 24, 2025
1 parent a5e3153 commit ed9107c
Show file tree
Hide file tree
Showing 5 changed files with 66 additions and 23 deletions.
24 changes: 24 additions & 0 deletions src/controllers/bmdashboard/bmExternalTeamController.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
const mongoose = require('mongoose');
const ExternalTeam = require('../../models/bmdashboard/buildingExternalTeam');

const createExternalTeam = async (req, res) => {
try {
const teamMember = new ExternalTeam(req.body);
const savedTeamMember = await teamMember.save();

res.status(201).json({
success: true,
data: savedTeamMember
});
} catch (error) {
console.error('Error creating team member:', error);
res.status(500).json({
success: false,
message: 'Failed to create external team member'
});
}
};

module.exports = {
createExternalTeam
};
33 changes: 33 additions & 0 deletions src/models/bmdashboard/buildingExternalTeam.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
const mongoose = require('mongoose');

const externalTeamSchema = new mongoose.Schema({
firstName: {
type: String,
required: true
},
lastName: {
type: String,
required: true
},
role: {
type: String,
required: true
},
roleSpecify: String,
team: {
type: String,
required: true
},
teamSpecify: String,
email: {
type: String,
required: true,
unique: true
},
countryCode: String,
phone: String
}, {
timestamps: true
});

module.exports = mongoose.model('ExternalTeam', externalTeamSchema);
22 changes: 0 additions & 22 deletions src/routes/bmdashboard/bmExternalTeam.js

This file was deleted.

8 changes: 8 additions & 0 deletions src/routes/bmdashboard/bmExternalTeamRouter.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
const express = require('express');

const router = express.Router();
const { createExternalTeam } = require('../../controllers/bmdashboard/bmExternalTeamController');

router.post('/externalTeam', createExternalTeam);

module.exports = router;
2 changes: 1 addition & 1 deletion src/startup/routes.js
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ const titleRouter = require('../routes/titleRouter')(title);
const bmToolRouter = require('../routes/bmdashboard/bmToolRouter')(buildingTool, toolType);
const bmEquipmentRouter = require('../routes/bmdashboard/bmEquipmentRouter')(buildingEquipment);
const bmIssueRouter = require('../routes/bmdashboard/bmIssueRouter')(buildingIssue);
const bmExternalTeam = require('../routes/bmdashboard/bmExternalTeam');
const bmExternalTeam = require('../routes/bmdashboard/bmExternalTeamRouter');

const blueSquareEmailAssignmentRouter = require('../routes/BlueSquareEmailAssignmentRouter')(
blueSquareEmailAssignment,
Expand Down

0 comments on commit ed9107c

Please sign in to comment.