{"id":16798226,"url":"https://github.com/r1tsuu/payload-plugin-collections-docs-order","last_synced_at":"2025-03-22T02:30:52.443Z","repository":{"id":223264744,"uuid":"759677117","full_name":"r1tsuu/payload-plugin-collections-docs-order","owner":"r1tsuu","description":"Plugin that adds an option to re-order collection documents with drag n drop ","archived":true,"fork":false,"pushed_at":"2024-05-04T22:23:31.000Z","size":1063,"stargazers_count":14,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-02-14T01:36:06.546Z","etag":null,"topics":["javascript","node","payload-plugin","payloadcms","react","typescript"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/r1tsuu.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"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-02-19T05:53:06.000Z","updated_at":"2025-01-05T15:42:31.000Z","dependencies_parsed_at":"2024-10-28T12:20:44.832Z","dependency_job_id":"fe576166-2da9-4c7f-beee-36ee9a7af019","html_url":"https://github.com/r1tsuu/payload-plugin-collections-docs-order","commit_stats":null,"previous_names":["r1tsuu/payload-plugin-collections-docs-order"],"tags_count":10,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/r1tsuu%2Fpayload-plugin-collections-docs-order","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/r1tsuu%2Fpayload-plugin-collections-docs-order/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/r1tsuu%2Fpayload-plugin-collections-docs-order/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/r1tsuu%2Fpayload-plugin-collections-docs-order/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/r1tsuu","download_url":"https://codeload.github.com/r1tsuu/payload-plugin-collections-docs-order/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244897751,"owners_count":20528285,"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":["javascript","node","payload-plugin","payloadcms","react","typescript"],"created_at":"2024-10-13T09:24:55.238Z","updated_at":"2025-03-22T02:30:51.859Z","avatar_url":"https://github.com/r1tsuu.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Note!\nThis repository for 3.0 is deprecated and has been moved to https://github.com/r1tsuu/payload-enchants in order to keep all of my payload-related packages in 1 place.\n[2.0 branch](https://github.com/r1tsuu/payload-plugin-collections-docs-order/tree/2.0)\n\n# Payload Plugin Collections Docs Order for Payload 3.0\n\n## About\n\nAdds an option to re-order collection documents with drag n drop (almost like array/blocks items). Then on your front end you can query documents with applied sort by `docOrder` field.\n\n## Video\n\nhttps://github.com/r1tsuu/payload-plugin-collections-docs-order/assets/64744993/2c13cdd9-f809-4c40-82c6-0b6f78997f74\n\n## Install\n\n`pnpm add @r1tsu/payload-plugin-collections-docs-order@1.0.0-beta.6`\nIn your payload.config.ts:\n\n```ts\n/// ....\nimport { collectionsDocsOrderPlugin } from '@r1tsu/payload-plugin-collections-docs-order';\n\nexport default buildConfig({\n  // ...\n  plugins: [\n    collectionsDocsOrderPlugin({\n      collections: [{ slug: 'pages' }], // The feature will be enabled only for collections that are in this array.,\n      access: ({ req, data }) =\u003e {\n        // Optional, configure access for `saveChanges` endpoint, default: Boolean(req.user)\n        return req.user?.collection === 'admins';\n      },\n    }),\n  ],\n});\n```\n\n## Querying with applied plugin's sort.\n\nREST:\n\n```ts\nfetch('http://localhost:3000/api/examples?sort=docOrder').then((res) =\u003e res.json());\n```\n\nLocal API:\n\n```ts\npayload.find({ collection: 'examples', sort: 'docOrder' });\n```\n\nGraphQL:\n\n```graphql\nquery {\n  Examples(sort: \"docOrder\") {\n    docs {\n      title\n    }\n  }\n\n```\n\n## Script to setup for collections that had documents before installing the plugin\n\n1. Create folder named cli in your project's root\n2. Copy this file to the created folder and update `collections` array with your needs. https://gist.github.com/r1tsuu/047008be9800dfcbe371247d10ee6794\n3. Run the file like that: `yarn ts-node --project ./tsconfig.server.json ./cli/pluginCollectionsDocsSetup.ts` (It will run for a database that in your .env, also be sure to backup if this on production)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fr1tsuu%2Fpayload-plugin-collections-docs-order","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fr1tsuu%2Fpayload-plugin-collections-docs-order","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fr1tsuu%2Fpayload-plugin-collections-docs-order/lists"}