-
Notifications
You must be signed in to change notification settings - Fork 0
All Offer APIs #24
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
Draft
petrubraha
wants to merge
23
commits into
main
Choose a base branch
from
offers
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
All Offer APIs #24
Changes from all commits
Commits
Show all changes
23 commits
Select commit
Hold shift + click to select a range
6e9e4ec
brand slug, store is a subresource of brand
petrubraha 88cd86e
brand slug, store is a subresource of brand
petrubraha 735de76
feat: resource declaration
petrubraha 4c3e03a
feat: new way of referencing a resource - slugs
petrubraha a0581a5
feat: new way of referencing a resource - simple ids
petrubraha 93be756
feat: changed store id type
petrubraha 82dc61d
feat: article apis
petrubraha 92c573b
feat: brand slug
petrubraha 5dc53fc
feat: offer apis
petrubraha fde053f
fix: stand subresource of a store
petrubraha ea3814e
fix: com. prefix of imports
petrubraha f90130c
fix: com. prefix of imports
petrubraha 3a2cb74
fix: imports
petrubraha a3dd6fc
fix: imports
petrubraha 3ac0fe0
fix: imports
petrubraha f283ff7
fix: productId
petrubraha 5488339
fix: build json
petrubraha 0c5a24d
fix: documentation traits
petrubraha d88df38
fix: default amount in articles member
petrubraha 4e78162
fix: offer required traits
petrubraha c5de32b
feat: route subresource of store
petrubraha bedbb12
feat: route subresource of store
petrubraha 87230fb
rebase
petrubraha File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,80 @@ | ||
| $version: "2" | ||
|
|
||
| namespace com.shopping.inandout.offer | ||
|
|
||
| use com.shopping.inandout#ResourceAlreadyExistsError | ||
| use com.shopping.inandout#ResourceNotFoundError | ||
| use com.shopping.inandout.util#ID | ||
| use com.shopping.inandout.util#NaturalNumber | ||
| use com.shopping.inandout.util#Percentage | ||
| use com.shopping.inandout.util#Slug | ||
| use com.shopping.inandout.util#SlugList | ||
| use com.shopping.inandout.util#TimeRange | ||
| use com.shopping.inandout.util#UIDList | ||
|
|
||
| resource Offer { | ||
| identifiers: { | ||
| brandSlug: Slug | ||
| offerId: ID | ||
| } | ||
| properties: { | ||
| percentage: Percentage | ||
| storeIdList: UIDList | ||
| articleSlugList: SlugList | ||
| dependencyList: DependencyList | ||
| timeRange: TimeRange | ||
| lifetime: NaturalNumber | ||
| createdAt: Timestamp | ||
| updatedAt: Timestamp | ||
| } | ||
| create: CreateOffer | ||
| read: GetOffer | ||
| list: ListOffers | ||
| update: UpdateOffer | ||
| delete: DeleteOffer | ||
| } | ||
|
|
||
| @http(method: "POST", uri: "/api/brands/{brandSlug}/offers") | ||
| operation CreateOffer { | ||
| input: CreateOfferInput | ||
| output: OfferSummary | ||
| errors: [ | ||
| ResourceAlreadyExistsError | ||
| ] | ||
| } | ||
|
|
||
| @readonly | ||
| @http(method: "GET", uri: "/api/brands/{brandSlug}/offers/{offerId}") | ||
| operation GetOffer { | ||
| input: GetOfferInput | ||
| output: OfferSummary | ||
| errors: [ | ||
| ResourceNotFoundError | ||
| ] | ||
| } | ||
|
|
||
| @readonly | ||
| @paginated | ||
| @http(method: "GET", uri: "/api/brands/{brandSlug}/offers") | ||
| operation ListOffers { | ||
| input: ListOffersInput | ||
| output: OfferSummaries | ||
| } | ||
|
|
||
| @http(method: "PATCH", uri: "/api/brands/{brandSlug}/offers/{offerId}") | ||
| @documentation("Non-idempotent cascading operation, creates/deletes internal resources as needed") | ||
| operation UpdateOffer { | ||
| input: UpdateOfferInput | ||
| output: OfferSummary | ||
| errors: [ | ||
| ResourceNotFoundError | ||
| ] | ||
| } | ||
|
|
||
| @idempotent | ||
| @http(method: "DELETE", uri: "/api/brands/{brandSlug}/offers/{offerId}") | ||
| @documentation("Not restricted cascading operation, deletes discounts, dependencies, etc.") | ||
| operation DeleteOffer { | ||
| input: DeleteOfferInput | ||
| output: OfferSummary | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,81 @@ | ||
| $version: "2" | ||
|
|
||
| namespace com.shopping.inandout.offer | ||
|
|
||
| use com.shopping.inandout.util#ID | ||
| use com.shopping.inandout.util#InputPagination | ||
| use com.shopping.inandout.util#NaturalNumber | ||
| use com.shopping.inandout.util#Percentage | ||
| use com.shopping.inandout.util#Slug | ||
| use com.shopping.inandout.util#SlugList | ||
| use com.shopping.inandout.util#TimeRange | ||
| use com.shopping.inandout.util#UIDList | ||
|
|
||
| structure CreateOfferInput { | ||
| @required | ||
| @httpLabel | ||
| brandSlug: Slug | ||
|
|
||
| @required | ||
| percentage: Percentage | ||
|
|
||
| storeIdList: UIDList | ||
|
|
||
| @required | ||
| articleSlugList: SlugList | ||
|
|
||
| dependencyList: DependencyList | ||
|
|
||
| timeRange: TimeRange | ||
|
|
||
| @required | ||
| lifetime: NaturalNumber | ||
| } | ||
|
|
||
| structure GetOfferInput { | ||
| @required | ||
| @httpLabel | ||
| brandSlug: Slug | ||
|
|
||
| @required | ||
| @httpLabel | ||
| offerId: ID | ||
| } | ||
|
|
||
| structure ListOffersInput with [InputPagination] { | ||
| @required | ||
| @httpLabel | ||
| brandSlug: Slug | ||
|
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. dd some queries. offers added today? offer to expire today, tomorrow, in a week? offer to a product? offers in a store? |
||
| } | ||
|
|
||
| structure UpdateOfferInput { | ||
| @required | ||
| @httpLabel | ||
| brandSlug: Slug | ||
|
|
||
| @required | ||
| @httpLabel | ||
| offerId: ID | ||
|
|
||
| percentage: Percentage | ||
|
|
||
| storeIdList: UIDList | ||
|
|
||
| articleSlugList: SlugList | ||
|
|
||
| dependencyList: DependencyList | ||
|
|
||
| timeRange: TimeRange | ||
|
|
||
| lifetime: NaturalNumber | ||
| } | ||
|
|
||
| structure DeleteOfferInput { | ||
| @required | ||
| @httpLabel | ||
| brandSlug: Slug | ||
|
|
||
| @required | ||
| @httpLabel | ||
| offerId: ID | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,61 @@ | ||
| $version: "2" | ||
|
|
||
| namespace com.shopping.inandout.offer | ||
|
|
||
| use com.shopping.inandout.util#ID | ||
| use com.shopping.inandout.util#NaturalNumber | ||
| use com.shopping.inandout.util#OutputPagination | ||
| use com.shopping.inandout.util#Percentage | ||
| use com.shopping.inandout.util#Slug | ||
| use com.shopping.inandout.util#SlugList | ||
| use com.shopping.inandout.util#TimeRange | ||
| use com.shopping.inandout.util#UIDList | ||
|
|
||
| @documentation("Product dependency; it must be bought in order for the offer to activate.") | ||
| structure Dependency { | ||
| @required | ||
| articleSlug: Slug | ||
|
|
||
| quantity: NaturalNumber | ||
| } | ||
|
|
||
| list DependencyList { | ||
| member: Dependency | ||
| } | ||
|
|
||
| structure OfferSummary { | ||
| @required | ||
| brandSlug: Slug | ||
|
|
||
| @required | ||
| offerId: ID | ||
|
|
||
| @required | ||
| percentage: Percentage | ||
|
|
||
| storeIdList: UIDList | ||
|
|
||
| @required | ||
| articleSlugList: SlugList | ||
|
|
||
| dependencyList: DependencyList | ||
|
|
||
| timeRange: TimeRange | ||
|
|
||
| @required | ||
| lifetime: NaturalNumber | ||
|
|
||
| @required | ||
| createdAt: Timestamp | ||
|
|
||
| @required | ||
| updatedAt: Timestamp | ||
| } | ||
|
|
||
| list OfferSummaryList { | ||
| member: OfferSummary | ||
| } | ||
|
|
||
| structure OfferSummaries with [OutputPagination] { | ||
| tokens: OfferSummaryList | ||
| } |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
also 404 error, in case that brandSlug does not exist