-
Notifications
You must be signed in to change notification settings - Fork 13
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
feat(4276): add cancel operations for private/public clouds #4641
Conversation
billingId String @db.ObjectId | ||
billing Billing @relation("billing", fields: [billingId], references: [id]) | ||
billingId String? @db.ObjectId | ||
billing Billing? @relation("billing", fields: [billingId], references: [id]) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should billingId and billing itself be optional for already created product?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The error occurs because the billingId field in decisionData can be null, but Prisma's upsert method expects it to be a string, StringFieldUpdateOperationsInput, or undefined. To fix this, I ensured billingId is either a valid string or undefined before passing it to the upsert operation. This error propagates to almost every code block that handles public cloud billing. I had to make billing and billingId optional. This changes didn't break the code even after pulling live data from dev environment.
@@ -12,10 +12,12 @@ import { | |||
IconMoneybag, | |||
IconReceipt2, | |||
} from '@tabler/icons-react'; | |||
import { useSession } from 'next-auth/react'; | |||
import { useEffect, useState } from 'react'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
doesn't look like it is used
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed!
@@ -62,18 +62,18 @@ export const GET = apiHandler(async ({ pathParams, queryParams, session }) => { | |||
return BadRequestResponse('invalid account coding'); | |||
} | |||
|
|||
product = req.decisionData; | |||
product = req.decisionData as Product; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
do we really need this cast here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This has been removed
} | ||
|
||
const canDownloadMou = | ||
session.permissions.downloadBillingMou || | ||
product.members.some( | ||
product?.members.some( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
do we need this check here? Product is checked on line 50
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This has been removed
(member) => | ||
member.userId === session.user.id && | ||
arraysIntersect(member.roles, [PublicCloudProductMemberRole.BILLING_VIEWER]), | ||
); | ||
|
||
if (!canDownloadMou) { | ||
if (!canDownloadMou || !product) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same here, product is checked on line 50
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This has been removed
(doc.type === RequestType.DELETE || doc.type === RequestType.EDIT || doc.type === RequestType.CREATE); | ||
|
||
const canEdit = (canReview && doc.type !== RequestType.DELETE) || canCancel; | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don 't think that a user can edit own request
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't understand this comment. A user can edit own request, I made sure that the exact same requester is able to edit their request. The canEdit has to be true for the decisionStatus prop to be editable in the public cloud request.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Kolezhanchik please review the recent changes
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
still user can't edit own request, only admin can
Quality Gate passedIssues Measures |
The ability to cancel requests is available for all operations (CREATE, EDIT, DELETE) in both Private and Public Clouds, and is not limited to just CREATE requests. At any point during the provisioning cycle or after the provisioning cycle, particularly for the Public Cloud, active requests of any type can be cancelled.