Implement chore completion logic and user assignment validation
This commit is contained in:
parent
99453d0869
commit
41be361463
4 changed files with 159 additions and 10 deletions
|
@ -182,3 +182,15 @@ func (c *Chore) CanEdit(userID int, circleUsers []*cModel.UserCircleDetail) bool
|
|||
}
|
||||
return false
|
||||
}
|
||||
|
||||
func (c *Chore) CanComplete(userID int) bool {
|
||||
if c.AssignedTo == userID {
|
||||
return true
|
||||
}
|
||||
for _, a := range c.Assignees {
|
||||
if a.UserID == userID {
|
||||
return true
|
||||
}
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue