Skip to content

Commit

Permalink
[Seller Quotes] Add query for quote parent id (#63)
Browse files Browse the repository at this point in the history
* feat: add new markeplace splitting quotes on graphql

* feat: checking new field quotesManagedBy when value is SELLER

* docs: update CHANGELOG

* feat: add configuration for quote creation

* feat: add adjustment for quote seller

* chore: fix prettier errors

* fix: returning ids separated by commas when multiple quotes

* fix: check config and default settings with marketplace option

* feat: new fields for quotes managed by seller

* feat: new fields to save parent quote; change getQuotes query to filter only parent quotes

* feat: create client to notify seller quote

* feat: add changelog

* feat: verify and notify seller quote

* chore: removes console.log from SellerQuotesClient

* docs: update CHANGELOG and prettier fix on markdown

* fix: right splitting of seller quotes

* feat: refactor on creating seller quote map; avoid double check of seller

* refactor: seller quotes client constants

* feat: send creationDate on notify seller quote

* feat: provides a route for seller get a quote by id at marketplace

* docs: update CHANGELOG

* refactor: separating get seller quote into smaller functions

* refactor: function to get org anc cost center names

* refactor: create service class for seller quotes

* fix: removing approvedBySeller field from quote entity

* refactor: renaming seller quotes service to controller

* feat: provides a route for seller save a quote at marketplace

* feat: get seller quotes paginated

* feat: use seller quote controller

* docs: add changelog

* chore: fix misspell

* fix: use array destructuring

* fix: sorting get seller quotes for right pagination

* feat: supporting search and status filters on get seller quotes

* feat: using search filter on quote creator email

* feat: add split quote query

* fix: right dependencies

* fix: remove p-limit from root package.json

* feat: suport for custom sort and where on ger seller quotes paginated

* [Seller Quotes] Add new markeplace splitting quotes on graphql (#57)

* feat: add new markeplace splitting quotes on graphql

* docs: update CHANGELOG

* chore: fix prettier errors

* fix: check config and default settings with marketplace option

* docs: update CHANGELOG and prettier fix on markdown

---------

Co-authored-by: Bruna Santos <[email protected]>
Co-authored-by: Tiago de Andrade Freire <[email protected]>
Co-authored-by: Tiago de Andrade Freire <[email protected]>

---------

Co-authored-by: Bruna Santos <[email protected]>
Co-authored-by: Tiago de Andrade Freire <[email protected]>
Co-authored-by: Tiago de Andrade Freire <[email protected]>
Co-authored-by: Guido Bernal <[email protected]>
  • Loading branch information
5 people authored Jan 10, 2025
1 parent 99639f5 commit e60d318
Show file tree
Hide file tree
Showing 3 changed files with 54 additions and 0 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

- Provides a route for seller get paginated list of quotes at marketplace
- Provides a route for seller save a quote at marketplace
- Provides a route for get splited quotes based on parentID

## [2.7.0] - 2025-01-09

Expand Down
12 changes: 12 additions & 0 deletions graphql/schema.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,18 @@ type Query {
@withSession
@withSegment
@cacheControl(scope: PRIVATE, maxAge: SHORT)
getChildrenQuotes(
id: String
page: Int = 1
pageSize: Int = 25
sortOrder: String = "DESC"
sortedBy: String = "lastUpdate"
): Quotes
@auditAccess
@withPermissions
@withSession
@withSegment
@cacheControl(scope: PRIVATE, maxAge: SHORT)
}

type Mutation {
Expand Down
41 changes: 41 additions & 0 deletions node/resolvers/queries/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -291,6 +291,47 @@ export const Query = {
throw new GraphQLError(error)
}
},
getChildrenQuotes: async (
_: any,
{
id,
page,
pageSize,
sortOrder,
sortedBy,
}: {
id: string
page: number
pageSize: number
sortOrder: string
sortedBy: string
},
ctx: Context
) => {
const {
clients: { masterdata },
vtex: { logger },
} = ctx

await checkConfig(ctx)

try {
return await masterdata.searchDocumentsWithPaginationInfo({
dataEntity: QUOTE_DATA_ENTITY,
fields: QUOTE_FIELDS,
pagination: { page, pageSize },
schema: SCHEMA_VERSION,
sort: `${sortedBy} ${sortOrder}`,
where: `parentQuote=${id}`,
})
} catch (error) {
logger.error({
error,
message: 'getQuotes-error',
})
throw new GraphQLError(error)
}
},
getQuoteEnabledForUser: async (
_: any,
{ email }: { email: string },
Expand Down

0 comments on commit e60d318

Please sign in to comment.