category.go 778 B

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. package sites
  2. import (
  3. "github.com/0xJacky/Nginx-UI/model"
  4. "github.com/gin-gonic/gin"
  5. "github.com/uozi-tech/cosy"
  6. )
  7. func GetCategory(c *gin.Context) {
  8. }
  9. func GetCategoryList(c *gin.Context) {
  10. cosy.Core[model.SiteCategory](c).PagingList()
  11. }
  12. func AddCategory(c *gin.Context) {
  13. cosy.Core[model.SiteCategory](c).
  14. SetValidRules(gin.H{
  15. "name": "required",
  16. "sync_node_ids": "omitempty",
  17. }).
  18. Create()
  19. }
  20. func ModifyCategory(c *gin.Context) {
  21. cosy.Core[model.SiteCategory](c).
  22. SetValidRules(gin.H{
  23. "name": "required",
  24. "sync_node_ids": "omitempty",
  25. }).
  26. Modify()
  27. }
  28. func DeleteCategory(c *gin.Context) {
  29. cosy.Core[model.SiteCategory](c).Destroy()
  30. }
  31. func RecoverCategory(c *gin.Context) {
  32. cosy.Core[model.SiteCategory](c).Recover()
  33. }