Advertisement
Guest User

Location.ts

a guest
Feb 15th, 2023
44
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.74 KB | None | 0 0
  1. import { CollectionConfig } from "payload/types";
  2. import { isAdmin } from "../access/isAdmin";
  3.  
  4. export const LocationCategories: CollectionConfig = {
  5. slug: "location-categories",
  6. admin: {
  7. useAsTitle: "title",
  8. group: "Category",
  9. },
  10. access: {
  11. // Only admins can create
  12. create: isAdmin,
  13. // Only admins or editors with site access can read
  14. read: () => true,
  15. // Only admins can update
  16. update: isAdmin,
  17. // Only admins can delete
  18. delete: isAdmin,
  19. },
  20. fields: [
  21. {
  22. name: "title",
  23. type: "text",
  24. required: true,
  25. },
  26. {
  27. name: "locationGroup",
  28. type: "relationship",
  29. relationTo: "location-group-categories",
  30. required: true,
  31. },
  32. ],
  33. };
  34.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement