-
Notifications
You must be signed in to change notification settings - Fork 30
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
a5e3153
commit ed9107c
Showing
5 changed files
with
66 additions
and
23 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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); |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters