{"id":24540014,"url":"https://github.com/spurtcms/categories","last_synced_at":"2025-03-16T04:43:05.117Z","repository":{"id":232972398,"uuid":"781823416","full_name":"spurtcms/categories","owner":"spurtcms","description":null,"archived":false,"fork":false,"pushed_at":"2024-11-16T09:13:57.000Z","size":58,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-01-22T17:17:51.169Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/spurtcms.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-04-04T05:29:50.000Z","updated_at":"2024-11-16T09:13:34.000Z","dependencies_parsed_at":"2024-05-21T06:26:35.554Z","dependency_job_id":"c83ce3da-1a9a-4d5e-b6af-a4d562cf5f7c","html_url":"https://github.com/spurtcms/categories","commit_stats":null,"previous_names":["spurtcms/categories"],"tags_count":25,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/spurtcms%2Fcategories","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/spurtcms%2Fcategories/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/spurtcms%2Fcategories/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/spurtcms%2Fcategories/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/spurtcms","download_url":"https://codeload.github.com/spurtcms/categories/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243826778,"owners_count":20354220,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2025-01-22T17:17:53.804Z","updated_at":"2025-03-16T04:43:05.090Z","avatar_url":"https://github.com/spurtcms.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# categories Package\n\nThe 'Categories' package empowers administrators to define and structure content categories seamlessly. This package facilitates efficient content organization and user-friendly navigation within Golang projects, ensuring a streamlined browsing experience for users.\n\n\n\n## Features\n\n- Administrators can seamlessly navigate through the system's organizational structure by utilizing functions like CategoryGroupList, which retrieves an exhaustive list of existing category groups, while CreateCategoryGroup function allows the addition of new ones. \n- Updating and deleting category groups are facilitated by UpdateCategoryGroup and DeleteCategoryGroup functions respectively, ensuring adaptability and clutter-free organization. \n- ListCategory function furnishes a detailed rundown of available categories, while AddCategory empowers administrators to append new ones within existing groups. \n- Subcategory refinement is enabled through UpdateSubCategory and DeleteSubCategory functions, offering precision in content classification. \n- Detailed subcategory information is retrievable via GetSubCategoryDetails, and FilterSubCategory enables targeted management actions.\n- CheckCategoryGroupName and CheckSubCategoryName functions guarantee the uniqueness of category and subcategory names respectively, upholding data integrity. \n- There is a master function AllCategoriesWithSubList that provides a holistic view of the category ecosystem, ensuring administrators possess the necessary tools for streamlined and effective content organization within the CMS.\n\n# Installation\n\n``` bash\ngo get github.com/spurtcms/categories\n```\n\n\n# Usage Example\n\n``` bash\nimport (\n\t\"github.com/spurtcms/auth\"\n\t\"github.com/spurtcms/categories\"\n)\n\nfunc main() {\n\n\tAuth := auth.AuthSetup(auth.Config{\n\t\tUserId:     1,\n\t\tExpiryTime: 2,\n\t\tSecretKey:  \"SecretKey@123\",\n\t\tDB: \u0026gorm.DB{},\n\t\tRoleId: 1,\n\t})\n\n\ttoken, _ := Auth.CreateToken()\n\n\tAuth.VerifyToken(token, SecretKey)\n\n\tpermisison, _ := Auth.IsGranted(\"Categories Group\", auth.CRUD)\n\n\tCategory := categories.CategoriesSetup(categories.Config{\n\t\tDB:               \u0026gorm.DB{},\n\t\tAuthEnable:       true,\n\t\tPermissionEnable: true,\n\t\tAuth:             Auth,\n\t})\n\n\t//categorygroup\n\tif permisison {\n\n\t\t//list categorygroup\n\t\tCategorygrouplist, count, err := Category.CategoryGroupList(10, 0, categories.Filter{},1,1)\n\t\tfmt.Println(Categorygrouplist, count, err)\n\n\t\t//create categorygroup\n\t\tcerr := Category.CreateCategoryGroup(categories.CategoryCreate{\n\t\t\tCategoryName: \"Default Group\",\n\t\t\tCategorySlug: \"default_group\",\n\t\t\tTenantId: 1\n\t\t})\n\n\t\tif cerr != nil {\n\n\t\t\tfmt.Println(cerr)\n\t\t}\n\n\t\t//update categorygroup\n\t\tuerr := Category.UpdateCategoryGroup(categories.CategoryCreate{\n\t\t\tId:           1,\n\t\t\tCategoryName: \"Default Group\",\n\t\t\tCategorySlug: \"default_group\",\n\t\t\tTenantId: 1\n\t\t})\n\n\t\tif uerr != nil {\n\n\t\t\tfmt.Println(uerr)\n\t\t}\n\n\t\t// delete categorygroup\n\t\tderr := Category.DeleteCategoryGroup(1,1,1)\n\n\t\tif derr != nil {\n\n\t\t\tfmt.Println(derr)\n\t\t}\n\t}\n\n\tcpermisison, _ := Auth.IsGranted(\"Categories\", auth.CRUD)\n\n\tif cpermisison {\n\n\t\t//category list\n\t\tCategorylist, fnlist, parentcategory, count, err := Category.ListCategory(10, 0, Filter{},1,1)\n\t\tfmt.Println(Categorylist, fnlist, parentcategory, count, err)\n\n\t\t//create category\n\t\tcerr := Category.AddCategory(categories.CategoryCreate{\n\t\t\tCategoryName: \"Default Category\",\n\t\t\t CategorySlug: \"default_category\",\n\t\t\t  ParentId: 1,\n\t\t\t  TenantId:1\n\t\t\t})\n\n\t\t\tif cerr != nil {\n\n\t\t\t\tfmt.Println(cerr)\n\t\t\t}\n\n\t\t//update category\n\t\tuerr := Category.UpdateSubCategory(categories.CategoryCreate{\n\t\t\tId: 5,\n\t\t\tCategoryName: \"Default Category\",\n\t\t\tCategorySlug: \"default_category\",\n\t\t\tParentId: 2,\n\t\t},1)\n\n\t\tif uerr != nil {\n\n\t\t\tfmt.Println(uerr)\n\t\t}\n\n\t\t//delete category\n\t\tderr := Category.DeleteSubCategory(2, 1,1)\n\n\t\tif derr != nil {\n\n\t\t\tfmt.Println(derr)\n\t\t}\n\n\t}\n}\n\n```\n# Getting help\nIf you encounter a problem with the package,please refer [Please refer [(https://www.spurtcms.com/documentation/cms-admin)] or you can create a new Issue in this repo[https://github.com/spurtcms/categories/issues]. \n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fspurtcms%2Fcategories","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fspurtcms%2Fcategories","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fspurtcms%2Fcategories/lists"}