category.go 817 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. cosy.Core[model.SiteCategory](c).Get()
  9. }
  10. func GetCategoryList(c *gin.Context) {
  11. cosy.Core[model.SiteCategory](c).PagingList()
  12. }
  13. func AddCategory(c *gin.Context) {
  14. cosy.Core[model.SiteCategory](c).
  15. SetValidRules(gin.H{
  16. "name": "required",
  17. "sync_node_ids": "omitempty",
  18. }).
  19. Create()
  20. }
  21. func ModifyCategory(c *gin.Context) {
  22. cosy.Core[model.SiteCategory](c).
  23. SetValidRules(gin.H{
  24. "name": "required",
  25. "sync_node_ids": "omitempty",
  26. }).
  27. Modify()
  28. }
  29. func DeleteCategory(c *gin.Context) {
  30. cosy.Core[model.SiteCategory](c).Destroy()
  31. }
  32. func RecoverCategory(c *gin.Context) {
  33. cosy.Core[model.SiteCategory](c).Recover()
  34. }