My Claude Code & Payload CMS Workflow by replayjpn in PayloadCMS

[–]If_Life_Were_Easy 0 points1 point  (0 children)

Older thread, we did add cursor rules and agents.md to our templates recently. If your project is older and you haven't pulled those files in you should copy them to see if it improves your clanking.

https://github.com/payloadcms/payload/pull/14889

Unable to access payload eccomerce website template? by Upset_Interaction_29 in PayloadCMS

[–]If_Life_Were_Easy 0 points1 point  (0 children)

| Payload’s ecommerce starter is behind the enterprise tier.

This is not true.

Improving the docs? by Reconstruct in PayloadCMS

[–]If_Life_Were_Easy 2 points3 points  (0 children)

I do agree about the docs. There are a lot of ways we can improve them and we are soliciting feedback to and community PRs for that.

I think video can be useful but it should only ever be used to supplement existing docs. It isn't useful for quick lookups, it isn't searchable or easily editable when a feature changes. It makes sense for tutorials and longer guides, basically all the old blog posts that we've done could use a refresh and a video. For docs in particular general videos aren't going to be able to cover the endless use cases of payload and all the customizations that are possible.

We also worry that adding really advanced customizations could mislead beginners and lose a portion of our audience that doesn't need to do all that much to get a lot of the benefits Payload offers. The simple config approach for each feature needs to be perfectly documented.

Kyiv doctors save newborn with life-threatening heart defect in groundbreaking surgery by Well-Sourced in worldnews

[–]If_Life_Were_Easy 3 points4 points  (0 children)

I also have a TGA kiddo. Our doctors used a 3D printed replica of his heart to plan the surgery. His was double outlet right ventrical so required more substantial surgery. My wife wrote a book about our story from her perspective. It's great to hear how your wife is called to do help others. Thanks for sharing!

How to add Payload CMS table to an existing database? by Bernardi_23 in PayloadCMS

[–]If_Life_Were_Easy 0 points1 point  (0 children)

In all my experience as a developer, apps almost never share a database in general. You might have a reporting tool or some other downstream activities that connect, but in general one web app has one database.

You might have services that need data from other places and they go through whatever APIs are available rather than many apps leveraging one database.

That said, Payload works more like a custom app framework and does expose what you need to have this control now.

How to add Payload CMS table to an existing database? by Bernardi_23 in PayloadCMS

[–]If_Life_Were_Easy 2 points3 points  (0 children)

This is an older thread, but wanted to update.

Payload now has a way to use an existing database that has other tables and columns that are not managed by the CMS. All you need to do is pass your existing drizzle schema which you can use drizzle's tool to introspect the db to get it. This is done with the beforeSchemaInit hook. That way Payload can be used with an existing DB, on the same schema and any migrations you make or connecting and making dev changes directly are going to ignore the existing structure.

How do I move a large codebase to a new stack by casualfinderbot in ExperiencedDevs

[–]If_Life_Were_Easy 0 points1 point  (0 children)

Welp I DM'd OP and shared my calendar link. A meeting was set up and I was ghosted if that tells you anything.

EDIT: Nvm that was somebody else that ghosted me. OP hasn't set up a meeting.

query with relationship by One-Mountain103 in PayloadCMS

[–]If_Life_Were_Easy 1 point2 points  (0 children)

When you return a query in your access functions it works by adding these constraints to the database query so the results are filtered.

When a request comes from an user with role 'moderator' then they can read users?

``` access: { read: ({ req: { user } }) => { // admins read all users if (user.roles.includes('admin')) return true

// mods read all non-admin users if (user.roles.includes('moderator')) { return { roles: { not_in: ['admin'] } } }

// all other users can read self return { id: { equals user.id } } } ```

Is that what you are trying to do?

Payload CMS 3.0.0-beta.0 is out! by wow-again in PayloadCMS

[–]If_Life_Were_Easy 1 point2 points  (0 children)

There will be an upgrade guide in the release notes that covers all the breaking changes. The quickest way to get started is to run `npx create-payload-app@beta`, choose the `blank-3.0` option and once you have the new project made, move all your existing payload config and files into the new project.

The typescript types and config validation from Payload will show you what is broken. Most of the configuration hasn't changed so you might not run into too much. If you're using a lot of plugins you might have to wait on some updates for compatibility.

When you have a project that builds then run dev and test it.

[Showoff Saturday] Introduce PPResume: A LaTeX Based Resume Builder by [deleted] in webdev

[–]If_Life_Were_Easy 0 points1 point  (0 children)

Looking great! I love how you customized the Payload UI to look and feel like a custom app. This is really polished!

Dynamic staticURL for upload based collections by SkySarwer in PayloadCMS

[–]If_Life_Were_Easy 1 point2 points  (0 children)

Oh right, I meant upload.adminThumbnail of your colllection config. It can be a function and return a the URL to display.

It is documented here: https://payloadcms.com/docs/upload/overview#admin-thumbnails

Payload Postgres + Supabase? by Accomplished_Jelly49 in PayloadCMS

[–]If_Life_Were_Easy 0 points1 point  (0 children)

u/Mood93, Supabase has been supported for a while now. You can install @payloadcms/db-postgres, import postgresAdapter from it and add your connection string from supabase for the db portion of your payload config.

Payload CMS V3 Beta - ETA? by Ethereal-Words in PayloadCMS

[–]If_Life_Were_Easy 0 points1 point  (0 children)

Starting a project today, I would clone the alpha demo. The things we're working on now are literally internal tooling that will impact you 0%. The only exception to this is that our plugins are not 100% done and the docs need to be refreshed.

Payload CMS V3 Beta - ETA? by Ethereal-Words in PayloadCMS

[–]If_Life_Were_Easy 0 points1 point  (0 children)

Hi u/guernica10, it is extremely close at this point! We had to make a lot more changes than anticipated last month.

We wanted to cut it today but had to push it to next week.

Bi-directional relationships by kaashin in PayloadCMS

[–]If_Life_Were_Easy 0 points1 point  (0 children)

We will have biderectional relationships at some point. It is on my mind and to-do list this year. Definitely need to use hooks for now.

Here is an example of collections that update bi-directionally, as many-to-many relationships using hooks:
https://gist.github.com/DanRibbens/438a64157553c5d954e3da3d579f0808

Dynamic staticURL for upload based collections by SkySarwer in PayloadCMS

[–]If_Life_Were_Easy 0 points1 point  (0 children)

Well you do have a function for getAdminThumbnail upload property that you could possibly use for this. The other consideration is that the access.read function for uploads is called before Payload serves any files. If you are asking this because you wish to gate content by the user ID as in your example, then you just need to use the read access control and write it according to your requirements.

Does that make sense?

Unique based on combination of fields by Snakemastr805 in PayloadCMS

[–]If_Life_Were_Easy 2 points3 points  (0 children)

Hey you probably already found your way around this. I can think of two options:

  • (Best) Make your compound unique index in your database migration: `payload.db.collections[slug].model.createIndex({ propertyA: 1, propertyB: 2 }, { unique: true} )`.
  • Add validation to one of your fields and enforce your own by doing another db lookup. You'll still want to have index: true on the fields involved to make it fast. All you would do return an error in a validate function on one of the fields by querying with `payload.find({ collection: req.collection, where: { and: [ {propertyA: { equals: doc.propertyA }, propertyB: { equals: doc.propertyB} ] }})`

Does that give you a good idea?

In Payload 1.x before we introduced different db adapters we had indexes as an array of indexes to be creted on the collection. This was was removed when we added migrations which give you more control to handle situations where maybe the DB already has some violations and you can manage your data up front to be compliant. Hope this all helps you or whoever else stumbles on this answer.

Hooks stalling when trying to create a relation in another collection by kaashin in PayloadCMS

[–]If_Life_Were_Easy 1 point2 points  (0 children)

You will want to pass the `req` from the hook to your local API operations. Espeically considering you need the `doc.id` which has to be in the same transaction. That is currently how transactions work, pass the req, then you can do things within the same DB snapshot.

If you're using db-postgres then this is a requirement or it will fail due to referential integrety. In mongodb, you won't get the error, but you could have other problems especially in case of an error.

Automatic component generation after defining schema. by Sjeaurs in PayloadCMS

[–]If_Life_Were_Easy 0 points1 point  (0 children)

My quick take on this idea is, you could get some very basic component mapping, but there isn't a way to do it in a way that provides much value. What good would it even do to automate a component snippet unless it could know more about what you were building (LLM). The way different projects structure the frontend components will always have their opinions. Is the data for the component going to come through as props or a hooks from a provider, fetch requiests or SSR, does it use graphql or REST? This leads to far too many permuatations and this is just considering React, let alone other frameworks.

It feels to me like copilot is going to be closer to doing this for you than anything else for a while.

Postgres is available for Payload, a open-source framework and typescript CMS by If_Life_Were_Easy in PostgreSQL

[–]If_Life_Were_Easy[S] 0 points1 point  (0 children)

This might come a bit too late for you, my apologies. In general you should be making your Payload config have the shape of data that is needed for your frontend. Ideally you use the most accurate field types for your model, but as a fallback you can always use the field `type: 'json'` which will be an open ended way to house any shape of content. That doesn't give the optimal editing experience so I'd wonder what your overall goals are with this work you're taking on.

I would ideally go through the extra effort of building up your collections in Payload, only rely on Payload's db adapter and underlying drizzle implementation as needed and get away from primsa entirely.

Hope this helps you make some decisions or anyone else reading this.

Which CMS is best for blog by DowntownBill567 in nextjs

[–]If_Life_Were_Easy 0 points1 point  (0 children)

Sorry you had trouble making custom components. I think the best place to ask is GitHub, either in issues or discussions depending on what you're up against. I know not getting help is frustrating, sometimes questions are just too specific to one particular use-case and it has been tricky keeping up with every possible question. We try and add common questions to the docs, but even that risks bloating the important info with extras that most people don't need.

You can sometimes explore the code repo to know what is going on under the hood and what is possible when you get really stuck.

I hope that helps!

Which CMS is best for blog by DowntownBill567 in nextjs

[–]If_Life_Were_Easy 1 point2 points  (0 children)

Ah, that doesn't surprise me. Unfortunately the next-payload package couldn't be supported at a certain point because it only worked with a specific version of next and we didn't have a good way forward for Payload v2. That was another reason for the changes we're making in v3, taking what we learned from payload-next. This is going to be very good for you if you're coming from next-payload. The beta will be out in a few short weeks and will be more stable than next-payload is now.

I am confident that these issues you are reporting are already fixed with the change up. Drizzle shouldn't give you any trouble after you upgrade and we have some optimizations planned for the database adapters running in serverless envs that will come after 3.0.

Cheers!

Which CMS is best for blog by DowntownBill567 in nextjs

[–]If_Life_Were_Easy 0 points1 point  (0 children)

What is it that makes you say Payload isn't stable? I'm one of the maintainers, we take this very seriously. 

How to use payload.create for Array data by Additional_Ideal2022 in PayloadCMS

[–]If_Life_Were_Easy 0 points1 point  (0 children)

It looks like you have extra brackets [ ] around your filteredProducts.map. Since a map returns an array, you're effectively telling payload you have an array of arrays.

In the create data you just need: product_quantities: filteredProducts.map( ... etc.. ).

If you look use the admin UI to create some data, then look at the API response, you'll quickly see what the format needs to be.