mirror of
https://github.com/wgh136/nysoure.git
synced 2025-09-27 12:17:24 +00:00
Add new file activity.
This commit is contained in:
@@ -29,6 +29,15 @@ func AddNewCommentActivity(userID, commentID uint) error {
|
||||
return db.Create(activity).Error
|
||||
}
|
||||
|
||||
func AddNewFileActivity(userID, fileID uint) error {
|
||||
activity := &model.Activity{
|
||||
UserID: userID,
|
||||
Type: model.ActivityTypeNewFile,
|
||||
RefID: fileID,
|
||||
}
|
||||
return db.Create(activity).Error
|
||||
}
|
||||
|
||||
func DeleteResourceActivity(resourceID uint) error {
|
||||
return db.Where("ref_id = ? AND (type = ? OR type = ?)", resourceID, model.ActivityTypeNewResource, model.ActivityTypeUpdateResource).Delete(&model.Activity{}).Error
|
||||
}
|
||||
|
Reference in New Issue
Block a user