Skip to content

fix: API /teams/:id/publish#9904

Merged
emrysal merged 2 commits intomainfrom
api/fix-team-publish-endpoint
Jul 4, 2023
Merged

fix: API /teams/:id/publish#9904
emrysal merged 2 commits intomainfrom
api/fix-team-publish-endpoint

Conversation

@zomars
Copy link
Copy Markdown
Contributor

@zomars zomars commented Jul 4, 2023

What does this PR do?

Fixes API build failure introduced after #9291

Type of change

  • Bug fix (non-breaking change which fixes an issue)

How should this be tested?

  • Locally or on preview, check that build succeeds
  • Test the publish endpoint against a valid api key
    • Locally, run yarn dev:api
    • Login to webapp and create an api key localhost:3000/settings/developer/api-keys
    • Copy the api key into the postman environment variable
    • On Postman select the local environment and overwrite the api_key with your own:
image image
  • Test the endpoint with valid body data as in the postman example

Mandatory Tasks

  • Make sure you have self-reviewed the code. A decent size PR without self-review might be rejected.

Fixes API build failure introduced after #9291
@vercel
Copy link
Copy Markdown

vercel Bot commented Jul 4, 2023

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
api ✅ Ready (Inspect) Visit Preview 💬 Add feedback Mar 19, 2024 3:06pm
cal ✅ Ready (Inspect) Visit Preview 💬 Add feedback Mar 19, 2024 3:06pm
ui ❌ Failed (Inspect) Mar 19, 2024 3:06pm
web-staging 🔄 Building (Inspect) Mar 19, 2024 3:06pm
1 Ignored Deployment
Name Status Preview Comments Updated (UTC)
dev ⬜️ Ignored (Inspect) Mar 19, 2024 3:06pm

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Jul 4, 2023

Thank you for following the naming conventions! 🙏

Copy link
Copy Markdown
Contributor Author

@zomars zomars left a comment

Choose a reason for hiding this comment

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

Ready for review

const { prisma, isCustomPrisma, isAdmin } = req;
const hasValidLicense = await checkLicense(prisma);
if (!hasValidLicense)
if (!hasValidLicense && process.env.NODE_ENV !== "development")
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

So we can test API on development

return await publishHandler({ input: { teamId }, ctx: { ...ctx, user } });
const caller = viewerTeamsRouter.createCaller(ctx);
// eslint-disable-next-line @typescript-eslint/no-explicit-any
return await caller.publish(req.query as any /* Let tRPC handle this */);
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Usted the same approach we have on slots and confirm link endpoints.


export const ZPublishInputSchema = z.object({
teamId: z.number(),
teamId: z.coerce.number(),
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

By default api paths are strings, so we update to account into this.

@zomars zomars requested review from a team July 4, 2023 01:42
@zomars zomars added 🐛 bug Something isn't working High priority Created by Linear-GitHub Sync api area: API, enterprise API, access token, OAuth labels Jul 4, 2023
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Jul 4, 2023

📦 Next.js Bundle Analysis for @calcom/web

This analysis was generated by the Next.js Bundle Analysis action. 🤖

This PR introduced no changes to the JavaScript bundle! 🙌

@deploysentinel
Copy link
Copy Markdown

deploysentinel Bot commented Jul 4, 2023

Current Playwright Test Results Summary

✅ 101 Passing - ⚠️ 1 Flaky

Run may still be in progress, this comment will be updated as current testing workflow or job completes...

(Last updated on 07/04/2023 05:55:57pm UTC)

Run Details

Running Workflow PR Update on Github Actions

Commit: fad5f4f

Started: 07/04/2023 05:53:57pm UTC

⚠️ Flakes

📄   apps/web/playwright/change-password.e2e.ts • 1 Flake

Test Case Results

Test Case Last 7 days Failures Last 7 days Flakes
Change Password Test change password
Retry 1Initial Attempt
0.84% (2) 2 / 239 runs
failed over last 7 days
1.67% (4) 4 / 239 runs
flaked over last 7 days

View Detailed Build Results


Copy link
Copy Markdown
Contributor

@emrysal emrysal left a comment

Choose a reason for hiding this comment

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

lgtm

@emrysal emrysal merged commit 9c84c3d into main Jul 4, 2023
@emrysal emrysal deleted the api/fix-team-publish-endpoint branch July 4, 2023 21:49
fritterhoff pushed a commit to hm-edu/cal.com that referenced this pull request Jul 25, 2023
Fixes API build failure introduced after calcom#9291
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

api area: API, enterprise API, access token, OAuth 🐛 bug Something isn't working High priority Created by Linear-GitHub Sync

Projects

No open projects
Status: No status

Development

Successfully merging this pull request may close these issues.

2 participants