明树Git Lab
Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Sign in
Toggle navigation
L
letian_backend
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
zengfanpei
letian_backend
Commits
d46725c0
Commit
d46725c0
authored
Sep 13, 2024
by
zengfanpei
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update
parent
06325b1e
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
75 additions
and
0 deletions
+75
-0
userController.js
controller/userController.js
+3
-0
letianAgrDecision.js
db/models/letianAgrDecision.js
+72
-0
No files found.
controller/userController.js
View file @
d46725c0
const
crypto
=
require
(
'crypto'
);
const
_
=
require
(
'lodash'
);
const
mongoose
=
require
(
'mongoose'
);
const
createError
=
require
(
'http-errors'
);
...
...
@@ -330,6 +331,8 @@ async function updateRole(req, res, next) {
async
function
deleteRole
(
req
,
res
,
next
)
{
try
{
// 角色删除 将用户中的角色去掉。$pull 从数组中删除一个指定元素
await
DB
.
User
.
updateMany
({},
{
$pull
:
{
roles
:
(
req
.
body
.
_id
)}});
const
ret
=
await
DB
.
Role
.
findOneAndUpdate
({
_id
:
req
.
body
.
_id
},
{
del
:
1
});
res
.
sendData
(
ret
)
}
catch
(
error
)
{
...
...
db/models/letianAgrDecision.js
0 → 100644
View file @
d46725c0
const
mongoose
=
require
(
'mongoose'
);
const
Schema
=
mongoose
.
Schema
;
const
moment
=
require
(
'moment'
);
/**
* 农事决策--由专家录入
*/
const
AgrTaskSchema
=
new
Schema
({
name
:
{
type
:
"任务名称"
,
},
agrType
:
{
type
:
Number
,
comment
:
"农事类型"
,
},
startTime
:
{
type
:
Date
,
omment
:
"任务开始日期"
,
},
endTime
:
{
type
:
Date
,
omment
:
"任务结束日期"
,
},
leader
:
{
type
:
mongoose
.
Types
.
ObjectId
,
ref
:
'User'
,
comment
:
"负责人--从分配负责人开始, 任务就开启"
},
status
:
{
type
:
Number
,
comment
:
"1. 待分配(没有leader), 3. 进行中, 5 已完成"
},
auditStatus
:
{
type
:
Number
,
comment
:
"1. 待审核, 2, 审核通过, 3.审核不通过, 记录最新的审核记录"
},
creator
:
{
type
:
mongoose
.
Types
.
ObjectId
,
ref
:
'User'
,
comment
:
"创建人"
},
createdAt
:
{
type
:
Date
,
default
:
Date
.
now
,
get
:
v
=>
moment
(
v
).
format
(
"YYYY-MM-DD HH:mm:ss"
),
},
updatedAt
:
{
type
:
Date
,
default
:
Date
.
now
,
get
:
v
=>
moment
(
v
).
format
(
"YYYY-MM-DD HH:mm:ss"
),
},
del
:
{
type
:
Number
,
default
:
0
,
comment
:
'默认0 , 1:表示删除, 若有其他隐藏业务 不要混用此字段。'
}
},
{
toJSON
:
{
getters
:
true
}
});
const
AgrTask
=
mongoose
.
model
(
'AgrTask'
,
AgrTaskSchema
,
'letianAgrTask'
);
module
.
exports
=
AgrTask
;
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment