This commit is contained in:
+8
-2
@@ -1319,8 +1319,8 @@ export const teamResolvers = {
|
|||||||
updateQuotation: async (_: unknown, args: { quotationUuid: string; input: UpdateQuotationInput }, ctx: AuthContext) => {
|
updateQuotation: async (_: unknown, args: { quotationUuid: string; input: UpdateQuotationInput }, ctx: AuthContext) => {
|
||||||
const access = assertTeamAccess(ctx)
|
const access = assertTeamAccess(ctx)
|
||||||
const current = await loadQuotationOrThrow(args.quotationUuid, access.teamUuid)
|
const current = await loadQuotationOrThrow(args.quotationUuid, access.teamUuid)
|
||||||
if (hasOwn(args.input, 'clientCurrency') && current.status === 'converted') {
|
if (current.status === 'converted') {
|
||||||
throw new GraphQLError('Converted quotation currency is fixed')
|
throw new GraphQLError('Converted quotation is fixed')
|
||||||
}
|
}
|
||||||
const teamAccess = { teamUuid: current.teamUuid, userId: access.userId }
|
const teamAccess = { teamUuid: current.teamUuid, userId: access.userId }
|
||||||
const actor = { userId: access.userId, label: actorLabel(teamAccess) }
|
const actor = { userId: access.userId, label: actorLabel(teamAccess) }
|
||||||
@@ -1343,6 +1343,9 @@ export const teamResolvers = {
|
|||||||
refreshQuotationTariff: async (_: unknown, args: { quotationUuid: string }, ctx: AuthContext) => {
|
refreshQuotationTariff: async (_: unknown, args: { quotationUuid: string }, ctx: AuthContext) => {
|
||||||
const access = assertTeamAccess(ctx)
|
const access = assertTeamAccess(ctx)
|
||||||
const current = await loadQuotationOrThrow(args.quotationUuid, access.teamUuid)
|
const current = await loadQuotationOrThrow(args.quotationUuid, access.teamUuid)
|
||||||
|
if (current.status === 'converted') {
|
||||||
|
throw new GraphQLError('Converted quotation is fixed')
|
||||||
|
}
|
||||||
const teamAccess = { teamUuid: current.teamUuid, userId: access.userId }
|
const teamAccess = { teamUuid: current.teamUuid, userId: access.userId }
|
||||||
const actor = { userId: access.userId, label: actorLabel(teamAccess) }
|
const actor = { userId: access.userId, label: actorLabel(teamAccess) }
|
||||||
const refreshed = await refreshQuotationSelection(current.uuid, current.teamUuid, actor)
|
const refreshed = await refreshQuotationSelection(current.uuid, current.teamUuid, actor)
|
||||||
@@ -1352,6 +1355,9 @@ export const teamResolvers = {
|
|||||||
selectQuotationTariff: async (_: unknown, args: { quotationUuid: string; tariffReferenceUuid: string }, ctx: AuthContext) => {
|
selectQuotationTariff: async (_: unknown, args: { quotationUuid: string; tariffReferenceUuid: string }, ctx: AuthContext) => {
|
||||||
const access = assertTeamAccess(ctx)
|
const access = assertTeamAccess(ctx)
|
||||||
const quotation = await loadQuotationOrThrow(args.quotationUuid, access.teamUuid)
|
const quotation = await loadQuotationOrThrow(args.quotationUuid, access.teamUuid)
|
||||||
|
if (quotation.status === 'converted') {
|
||||||
|
throw new GraphQLError('Converted quotation is fixed')
|
||||||
|
}
|
||||||
const teamAccess = { teamUuid: quotation.teamUuid, userId: access.userId }
|
const teamAccess = { teamUuid: quotation.teamUuid, userId: access.userId }
|
||||||
const actor = { userId: access.userId, label: actorLabel(teamAccess) }
|
const actor = { userId: access.userId, label: actorLabel(teamAccess) }
|
||||||
const tariff = await loadTariffOrThrow(args.tariffReferenceUuid, quotation.teamUuid)
|
const tariff = await loadTariffOrThrow(args.tariffReferenceUuid, quotation.teamUuid)
|
||||||
|
|||||||
Reference in New Issue
Block a user