无法删除
This commit is contained in:
parent
81050bd297
commit
a91b2dad1f
|
|
@ -76,13 +76,14 @@ const update=(req,res,next)=>{
|
|||
|
||||
const destroy=(req,res,next)=>{
|
||||
let employeeID=req.body.employeeID
|
||||
Employee.findByIdAndDelete(employeeID)
|
||||
Employee.findByIdAndDelete({"_id": ObjectId( employeeID)})
|
||||
.then(()=>{
|
||||
res.json({
|
||||
message: 'Employee deleted successfully.'
|
||||
})
|
||||
})
|
||||
.catch(error=>{
|
||||
console.log(error)
|
||||
res.json({
|
||||
message: 'An error Occred!'
|
||||
})
|
||||
|
|
|
|||
|
|
@ -2,8 +2,6 @@
|
|||
"dependencies": {
|
||||
"body-parser": "^1.20.3",
|
||||
"express": "^4.21.0",
|
||||
"mongo": "^0.1.0",
|
||||
"mongodb": "^6.9.0",
|
||||
"mongoose": "^8.6.2",
|
||||
"morgan": "^1.10.0",
|
||||
"multer": "1.4.5-lts.1"
|
||||
|
|
|
|||
|
|
@ -14,12 +14,6 @@ importers:
|
|||
express:
|
||||
specifier: ^4.21.0
|
||||
version: 4.21.0
|
||||
mongo:
|
||||
specifier: ^0.1.0
|
||||
version: 0.1.0
|
||||
mongodb:
|
||||
specifier: ^6.9.0
|
||||
version: 6.9.0
|
||||
mongoose:
|
||||
specifier: ^8.6.2
|
||||
version: 8.6.2
|
||||
|
|
@ -327,10 +321,6 @@ packages:
|
|||
resolution: {integrity: sha512-FP+p8RB8OWpF3YZBCrP5gtADmtXApB5AMLn+vdyA+PyxCjrCs00mjyUozssO33cwDeT3wNGdLxJ5M//YqtHAJw==}
|
||||
hasBin: true
|
||||
|
||||
mongo@0.1.0:
|
||||
resolution: {integrity: sha512-2MPq+GCNKhah0V/g/HIQI/S1h6Ycd87KPuXAITkeXWT6wncvABFxOaXdzCKlRvLSQRUkDimllrRrhoHUTD8usg==}
|
||||
engines: {node: '>= 0.4.0'}
|
||||
|
||||
mongodb-connection-string-url@3.0.1:
|
||||
resolution: {integrity: sha512-XqMGwRX0Lgn05TDB4PyG2h2kKO/FfWJyCzYQbIhXUxz7ETt0I/FqHjUeqj37irJ+Dl1ZtU82uYyj14u2XsZKfg==}
|
||||
|
||||
|
|
@ -361,33 +351,6 @@ packages:
|
|||
socks:
|
||||
optional: true
|
||||
|
||||
mongodb@6.9.0:
|
||||
resolution: {integrity: sha512-UMopBVx1LmEUbW/QE0Hw18u583PEDVQmUmVzzBRH0o/xtE9DBRA5ZYLOjpLIa03i8FXjzvQECJcqoMvCXftTUA==}
|
||||
engines: {node: '>=16.20.1'}
|
||||
peerDependencies:
|
||||
'@aws-sdk/credential-providers': ^3.188.0
|
||||
'@mongodb-js/zstd': ^1.1.0
|
||||
gcp-metadata: ^5.2.0
|
||||
kerberos: ^2.0.1
|
||||
mongodb-client-encryption: '>=6.0.0 <7'
|
||||
snappy: ^7.2.2
|
||||
socks: ^2.7.1
|
||||
peerDependenciesMeta:
|
||||
'@aws-sdk/credential-providers':
|
||||
optional: true
|
||||
'@mongodb-js/zstd':
|
||||
optional: true
|
||||
gcp-metadata:
|
||||
optional: true
|
||||
kerberos:
|
||||
optional: true
|
||||
mongodb-client-encryption:
|
||||
optional: true
|
||||
snappy:
|
||||
optional: true
|
||||
socks:
|
||||
optional: true
|
||||
|
||||
mongoose@8.6.2:
|
||||
resolution: {integrity: sha512-ErbDVvuUzUfyQpXvJ6sXznmZDICD8r6wIsa0VKjJtB6/LZncqwUn5Um040G1BaNo6L3Jz+xItLSwT0wZmSmUaQ==}
|
||||
engines: {node: '>=16.20.1'}
|
||||
|
|
@ -902,18 +865,6 @@ snapshots:
|
|||
dependencies:
|
||||
minimist: 1.2.8
|
||||
|
||||
mongo@0.1.0:
|
||||
dependencies:
|
||||
mongodb: 6.9.0
|
||||
transitivePeerDependencies:
|
||||
- '@aws-sdk/credential-providers'
|
||||
- '@mongodb-js/zstd'
|
||||
- gcp-metadata
|
||||
- kerberos
|
||||
- mongodb-client-encryption
|
||||
- snappy
|
||||
- socks
|
||||
|
||||
mongodb-connection-string-url@3.0.1:
|
||||
dependencies:
|
||||
'@types/whatwg-url': 11.0.5
|
||||
|
|
@ -925,12 +876,6 @@ snapshots:
|
|||
bson: 6.8.0
|
||||
mongodb-connection-string-url: 3.0.1
|
||||
|
||||
mongodb@6.9.0:
|
||||
dependencies:
|
||||
'@mongodb-js/saslprep': 1.1.9
|
||||
bson: 6.8.0
|
||||
mongodb-connection-string-url: 3.0.1
|
||||
|
||||
mongoose@8.6.2:
|
||||
dependencies:
|
||||
bson: 6.8.0
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@
|
|||
POST {{url}}/employee/detail HTTP/1.1
|
||||
|
||||
{
|
||||
"employeeID": "66e996d8c0f1d788626a2100"
|
||||
"employeeID": "66e99aca14f420ccd5209104"
|
||||
}
|
||||
|
||||
###
|
||||
|
|
@ -15,11 +15,11 @@ POST {{url}}/employee/create HTTP/1.1
|
|||
Content-Type: application/json
|
||||
|
||||
{
|
||||
"name": "john mike",
|
||||
"name": "john mike2",
|
||||
"designation": "dsfsafdsafadsf",
|
||||
"email": "sdfs@sdf.com",
|
||||
"phone": "+8612363378941",
|
||||
"age": 25
|
||||
"age": 20
|
||||
}
|
||||
|
||||
###
|
||||
|
|
@ -38,5 +38,5 @@ POST {{url}}/employee/update HTTP/1.1
|
|||
POST {{url}}/employee/delete HTTP/1.1
|
||||
|
||||
{
|
||||
"employeeID": "66e996d8c0f1d788626a2100"
|
||||
"employeeID": "66e99c327dcae1c68f763366"
|
||||
}
|
||||
Loading…
Reference in New Issue