Skip to content

Feature/11 wordpress api#61

Open
Jxl-s wants to merge 9 commits intodevelopfrom
feature/11-wordpress-api
Open

Feature/11 wordpress api#61
Jxl-s wants to merge 9 commits intodevelopfrom
feature/11-wordpress-api

Conversation

@Jxl-s
Copy link
Copy Markdown
Contributor

@Jxl-s Jxl-s commented May 2, 2026

Closes #11

Overview

Exposes an endpoint to show services and setup a wordpress site with a block show services

Testing

  • Run the app
  • Run the block's development server
cd wp-blocks/mcld-services
npm run start
  • Run the dummy wordpress server
cd wp-blocks/mcld-services
npm run server:start
  • Activate the plugin, add the block to a site, and configure the API URL in the Settings

Screenshots / Screencasts

image

Checklist

  • Code is neat, readable, and works
  • Code is commented where appropriate and well-documented
  • Commit messages follow our guidelines
  • Issue number is linked
  • Branch is linked
  • Reviewers are assigned (one of your tech leads)

Tip: You can make the issue and then check them after the fact or replace [ ] with [x] to check it!

Notes

Make sure you have Docker installed to run

@Jxl-s Jxl-s requested review from RenaudBernier and martin0024 May 2, 2026 20:34
Copy link
Copy Markdown
Contributor

@martin0024 martin0024 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good but needs changes.
Could we use that instead Call external api with Cache

Comment thread app/api/public/services/route.ts Outdated
.where(eq(services.status, "active"));

const body = await Promise.all(
rows.map(async (row) => {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please add a try/catch to avoid if stripe crash then the routes crashes and it should return a message 'Impossible to fetch stripe services or no stripe services.

Comment thread app/api/public/services/route.ts Outdated

export async function GET() {
const rows = await db
.select()
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please select() only the fields we need not all of them.

.select({
        id: services.id,
        type: services.type,
        stripeProductId: services.stripeProductId,
        durationMinutes: services.durationMinutes,
        startDate: services.startDate,
        endDate: services.endDate,
        slots: services.slots,
      })

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cache and revalidate the route because public services do not change every second.
Right now, every time i reload the mcld page i call stripe api to get all services?
Maybe there is a getAllProducts instead of fetching each of them ? to check.

Copy link
Copy Markdown
Contributor

@RenaudBernier RenaudBernier left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants