Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: v2 create schedule with availabilities #14551

Merged
merged 4 commits into from Apr 12, 2024
Merged

Conversation

supalarry
Copy link
Contributor

@supalarry supalarry commented Apr 12, 2024

There was a refactor so validation for schedule availabilities changed. Previously create-availability.input.ts expected for startTime and endTime time in format "HH:mm:ss" but now we are submitting ISO8061 time format e.g. 2025-0412T13:17:56.324Z from the atom.

Driveby: remove permissions from public event-types endpoint

To test i submitted to "http://localhost:5555/api/v2/schedules"

{
  "name": "aasd",
  "timeZone": "Europe/Rome",
  "availabilities": [
    {
      "days": [
        1,
        2
      ],
      "startTime": "2025-0312T13:17:56.324Z",
      "endTime": "2025-04-12T16:17:56.324Z"
    }
  ],
  "isDefault": true
}

and got response:

{
  "status": "success",
  "data": {
    "id": 137,
    "name": "aasd",
    "isManaged": false,
    "workingHours": [
      {
        "days": [
          1,
          2
        ],
        "startTime": 797,
        "endTime": 977,
        "userId": 252
      }
    ],
    "schedule": [
      {
        "id": 176,
        "userId": 252,
        "eventTypeId": null,
        "days": [
          1,
          2
        ],
        "startTime": "1970-01-01T13:17:56.000Z",
        "endTime": "1970-01-01T16:17:56.000Z",
        "date": null,
        "scheduleId": 137
      }
    ],
    "availability": [
      [],
      [
        {
          "start": "2024-04-12T13:17:00.000Z",
          "end": "2024-04-12T16:17:00.000Z"
        }
      ],
      [
        {
          "start": "2024-04-12T13:17:00.000Z",
          "end": "2024-04-12T16:17:00.000Z"
        }
      ],
      [],
      [],
      [],
      []
    ],
    "timeZone": "Europe/Rome",
    "dateOverrides": [],
    "isDefault": true,
    "isLastSchedule": false,
    "readOnly": false
  }
}

@graphite-app graphite-app bot requested a review from a team April 12, 2024 15:15
@supalarry supalarry requested review from a team and removed request for a team April 12, 2024 15:15
Copy link
Contributor

github-actions bot commented Apr 12, 2024

Thank you for following the naming conventions! 🙏 Feel free to join our discord and post your PR link.

@dosubot dosubot bot added api area: API, enterprise API, access token, OAuth core area: core, team members only 🐛 bug Something isn't working labels Apr 12, 2024
@keithwillcode keithwillcode added the platform Anything related to our platform plan label Apr 12, 2024
Copy link

vercel bot commented Apr 12, 2024

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

4 Ignored Deployments
Name Status Preview Comments Updated (UTC)
ai ⬜️ Ignored (Inspect) Visit Preview Apr 12, 2024 3:45pm
cal ⬜️ Ignored (Inspect) Visit Preview Apr 12, 2024 3:45pm
calcom-web-canary ⬜️ Ignored (Inspect) Visit Preview Apr 12, 2024 3:45pm
qa-not-in-use ⬜️ Ignored (Inspect) Visit Preview Apr 12, 2024 3:45pm

@supalarry supalarry enabled auto-merge (squash) April 12, 2024 15:16

if (parts.length !== 3) {
throw new BadRequestException(`Invalid ${key} format. Expected format: HH:MM:SS. Received ${value}`);
throw new BadRequestException(
`Invalid time format. Expected format(ISO8061): 2025-0412T13:17:56.324Z. Received: ${value}`
Copy link
Contributor

Choose a reason for hiding this comment

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

Feels like for availabilities that are usually on the 0 second we should return back something like that.

e.g. 2025-0412T13:00:00Z or 2025-0412T13:30:00Z

Copy link
Contributor

Choose a reason for hiding this comment

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

I'm not even sure our system can support saving availabilities and then using those availabilities to calculate slots with times like these

Copy link
Contributor Author

@supalarry supalarry Apr 12, 2024

Choose a reason for hiding this comment

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

I checked payload of when availability is updated and "Save" is hit:

Screenshot 2024-04-12 at 17 28 11

And then I matched behaviour exactly in the PR code above - availability atom sends start and end time in the ISO8061 format. There are more elegant ways to write this input DTO but need to think about it and potentially refactor how the availability atom works.

Copy link
Contributor

Choose a reason for hiding this comment

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

Yeah that ISO format is definitely the one we want to support but what I was referring to is the date itself. The UI doesn’t support setting your availability down to the second.

Copy link

graphite-app bot commented Apr 12, 2024

Graphite Automations

"Add consumer team as reviewer" took an action on this PR • (04/12/24)

1 reviewer was added to this PR based on Keith Williams's automation.

Copy link
Contributor

📦 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! 🙌

Copy link

deploysentinel bot commented Apr 12, 2024

Current Playwright Test Results Summary

✅ 310 Passing - ⚠️ 14 Flaky

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

(Last updated on 04/12/2024 03:48:44pm UTC)

Run Details

Running Workflow PR Update on Github Actions

Commit: 4e1d469

Started: 04/12/2024 03:44:08pm UTC

⚠️ Flakes

📄   apps/web/playwright/booking-pages.e2e.ts • 1 Flake

Test Case Results

Test Case Last 7 days Failures Last 7 days Flakes
pro user -- legacy Time slots should be reserved when selected
Retry 1Initial Attempt
0% (0) 0 / 336 runs
failed over last 7 days
10.12% (34) 34 / 336 runs
flaked over last 7 days

📄   apps/web/playwright/profile.e2e.ts • 2 Flakes

Top 1 Common Error Messages

null

2 Test Cases Affected

Test Case Results

Test Case Last 7 days Failures Last 7 days Flakes
Update Profile Can add a new email as a secondary email
Retry 1Initial Attempt
0.60% (2) 2 / 331 runs
failed over last 7 days
0.60% (2) 2 / 331 runs
flaked over last 7 days
Update Profile Newly added secondary email should show as Unverified
Retry 1Initial Attempt
0.91% (3) 3 / 331 runs
failed over last 7 days
7.25% (24) 24 / 331 runs
flaked over last 7 days

📄   apps/web/playwright/availability.e2e.ts • 1 Flake

Test Case Results

Test Case Last 7 days Failures Last 7 days Flakes
Availablity Schedule listing
Retry 1Initial Attempt
0% (0) 0 / 341 runs
failed over last 7 days
0.29% (1) 1 / 341 run
flaked over last 7 days

📄   packages/embeds/embed-core/playwright/tests/action-based.e2e.ts • 8 Flakes

Top 1 Common Error Messages

null

8 Test Cases Affected

Test Case Results

Test Case Last 7 days Failures Last 7 days Flakes
Popup Tests should open embed iframe on click - Configured with light theme
Retry 1Initial Attempt
0% (0) 0 / 330 runs
failed over last 7 days
63.94% (211) 211 / 330 runs
flaked over last 7 days
Popup Tests should be able to reschedule
Retry 1Initial Attempt
-177.97% (-210) -210 / 118 runs
failed over last 7 days
177.97% (210) 210 / 118 runs
flaked over last 7 days
Popup Tests should open Routing Forms embed on click
Retry 1Initial Attempt
-177.97% (-210) -210 / 118 runs
failed over last 7 days
177.97% (210) 210 / 118 runs
flaked over last 7 days
Popup Tests Floating Button Popup Pro User - Configured in App with default setting of system theme should open embed iframe according to system theme when no theme is configured through Embed API
Retry 1Initial Attempt
-176.27% (-208) -208 / 118 runs
failed over last 7 days
177.97% (210) 210 / 118 runs
flaked over last 7 days
Popup Tests Floating Button Popup Pro User - Configured in App with default setting of system theme should open embed iframe according to system theme when configured with 'auto' theme using Embed API
Retry 1Initial Attempt
-181.03% (-210) -210 / 116 runs
failed over last 7 days
181.03% (210) 210 / 116 runs
flaked over last 7 days
Popup Tests Floating Button Popup Pro User - Configured in App with default setting of system theme should open embed iframe(Booker Profile Page) with dark theme when configured with dark theme using Embed API
Retry 1Initial Attempt
-181.03% (-210) -210 / 116 runs
failed over last 7 days
181.03% (210) 210 / 116 runs
flaked over last 7 days
Popup Tests Floating Button Popup Pro User - Configured in App with default setting of system theme should open embed iframe(Event Booking Page) with dark theme when configured with dark theme using Embed API
Retry 1Initial Attempt
-181.03% (-210) -210 / 116 runs
failed over last 7 days
181.03% (210) 210 / 116 runs
flaked over last 7 days
Popup Tests prendered embed should be loaded and apply the config given to it
Retry 1Initial Attempt
-181.03% (-210) -210 / 116 runs
failed over last 7 days
181.03% (210) 210 / 116 runs
flaked over last 7 days

📄   apps/web/playwright/integrations-stripe.e2e.ts • 1 Flake

Test Case Results

Test Case Last 7 days Failures Last 7 days Flakes
Stripe integration Pending payment booking should not be confirmed by default
Retry 1Initial Attempt
1.53% (5) 5 / 327 runs
failed over last 7 days
23.24% (76) 76 / 327 runs
flaked over last 7 days

📄   packages/embeds/embed-core/playwright/tests/inline.e2e.ts • 1 Flake

Test Case Results

Test Case Last 7 days Failures Last 7 days Flakes
Inline Iframe Inline Iframe - Configured with Dark Theme
Retry 1Initial Attempt
0.60% (2) 2 / 331 runs
failed over last 7 days
53.17% (176) 176 / 331 runs
flaked over last 7 days

View Detailed Build Results


@supalarry supalarry merged commit 5e98cca into main Apr 12, 2024
38 of 39 checks passed
@supalarry supalarry deleted the v2-fix-create-schedule branch April 12, 2024 15:49
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 core area: core, team members only platform Anything related to our platform plan
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants