-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(#549): fetch appropriate reference price from GraphQL (WIP)
- Loading branch information
1 parent
0d78a51
commit 0cf2d82
Showing
24 changed files
with
637 additions
and
106 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
49 changes: 49 additions & 0 deletions
49
...n/java/io/evitadb/externalApi/graphql/api/catalog/dataApi/dto/PrefetchedPriceForSale.java
This file contains 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,49 @@ | ||
/* | ||
* | ||
* _ _ ____ ____ | ||
* _____ _(_) |_ __ _| _ \| __ ) | ||
* / _ \ \ / / | __/ _` | | | | _ \ | ||
* | __/\ V /| | || (_| | |_| | |_) | | ||
* \___| \_/ |_|\__\__,_|____/|____/ | ||
* | ||
* Copyright (c) 2024 | ||
* | ||
* Licensed under the Business Source License, Version 1.1 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* https://github.com/FgForrest/evitaDB/blob/main/LICENSE | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
package io.evitadb.externalApi.graphql.api.catalog.dataApi.dto; | ||
|
||
import io.evitadb.api.requestResponse.data.PriceContract; | ||
import io.evitadb.api.requestResponse.data.structure.EntityDecorator; | ||
import lombok.Getter; | ||
import lombok.RequiredArgsConstructor; | ||
import lombok.experimental.Delegate; | ||
|
||
import javax.annotation.Nonnull; | ||
import java.util.Map; | ||
import java.util.Optional; | ||
|
||
/** | ||
* DTO representing prefetched price for sale with other precomputed prices. Other prices can be computed using the | ||
* {@link #getParentEntity()}. | ||
* | ||
* @author Lukáš Hornych, FG Forrest a.s. (c) 2024 | ||
*/ | ||
@RequiredArgsConstructor | ||
public class PrefetchedPriceForSale implements PriceContract { | ||
|
||
@Delegate @Nonnull private final PriceContract priceForSale; | ||
|
||
@Nonnull @Getter private final EntityDecorator parentEntity; | ||
@Nonnull @Getter private final Map<String, Optional<PriceContract>> accompanyingPrices; | ||
} |
This file contains 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
78 changes: 78 additions & 0 deletions
78
...lApi/graphql/api/catalog/dataApi/model/entity/AccompanyingPriceFieldHeaderDescriptor.java
This file contains 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,78 @@ | ||
/* | ||
* | ||
* _ _ ____ ____ | ||
* _____ _(_) |_ __ _| _ \| __ ) | ||
* / _ \ \ / / | __/ _` | | | | _ \ | ||
* | __/\ V /| | || (_| | |_| | |_) | | ||
* \___| \_/ |_|\__\__,_|____/|____/ | ||
* | ||
* Copyright (c) 2023-2024 | ||
* | ||
* Licensed under the Business Source License, Version 1.1 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* https://github.com/FgForrest/evitaDB/blob/main/LICENSE | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
package io.evitadb.externalApi.graphql.api.catalog.dataApi.model.entity; | ||
|
||
import io.evitadb.externalApi.api.model.PropertyDescriptor; | ||
|
||
import java.time.OffsetDateTime; | ||
|
||
import static io.evitadb.externalApi.api.model.PrimitivePropertyDataTypeDescriptor.nonNull; | ||
import static io.evitadb.externalApi.api.model.PrimitivePropertyDataTypeDescriptor.nullable; | ||
|
||
/** | ||
* Descriptor of header parameters of {@link PriceForSaleDescriptor#ACCOMPANYING_PRICE} field. | ||
* | ||
* @author Lukáš Hornych, FG Forrest a.s. (c) 2024 | ||
*/ | ||
public interface AccompanyingPriceFieldHeaderDescriptor { | ||
|
||
PropertyDescriptor PRICE_LISTS = PropertyDescriptor.builder() | ||
.name("priceLists") | ||
.description(""" | ||
Parameter specifying list of price lists ordered by priority for defining output price. | ||
""") | ||
.type(nonNull(String[].class)) | ||
.build(); | ||
PropertyDescriptor CURRENCY = PropertyDescriptor.builder() | ||
.name("currency") | ||
.description(""" | ||
Parameter specifying desired currency of output price if different currency that already defined is desired. | ||
""") | ||
// type is expected to be a currency enum | ||
.build(); | ||
PropertyDescriptor VALID_IN = PropertyDescriptor.builder() | ||
.name("validIn") | ||
.description(""" | ||
Parameter specifying when output price should be valid. If both `validInNow` and `validIn` parameters are | ||
specified `validIn` is used. | ||
""") | ||
.type(nullable(OffsetDateTime.class)) | ||
.build(); | ||
PropertyDescriptor VALID_NOW = PropertyDescriptor.builder() | ||
.name("validNow") | ||
.description(""" | ||
Parameter specifying when output price should be valid. The date time is resolved to `now` by evitaDB. If both `validNow` | ||
and `validIn` parameters are specified `validIn` is used. | ||
""") | ||
.type(nullable(Boolean.class)) | ||
.build(); | ||
PropertyDescriptor LOCALE = PropertyDescriptor.builder() | ||
.name("locale") | ||
.description(""" | ||
Parameter specifying desired locale price formatting. | ||
If not specified, desired entity locale is used instead. | ||
""") | ||
// type is expected to be a locale enum | ||
.build(); | ||
} |
This file contains 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
51 changes: 51 additions & 0 deletions
51
.../evitadb/externalApi/graphql/api/catalog/dataApi/model/entity/PriceForSaleDescriptor.java
This file contains 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,51 @@ | ||
/* | ||
* | ||
* _ _ ____ ____ | ||
* _____ _(_) |_ __ _| _ \| __ ) | ||
* / _ \ \ / / | __/ _` | | | | _ \ | ||
* | __/\ V /| | || (_| | |_| | |_) | | ||
* \___| \_/ |_|\__\__,_|____/|____/ | ||
* | ||
* Copyright (c) 2024 | ||
* | ||
* Licensed under the Business Source License, Version 1.1 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* https://github.com/FgForrest/evitaDB/blob/main/LICENSE | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
package io.evitadb.externalApi.graphql.api.catalog.dataApi.model.entity; | ||
|
||
import io.evitadb.externalApi.api.catalog.dataApi.model.PriceDescriptor; | ||
import io.evitadb.externalApi.api.model.ObjectDescriptor; | ||
import io.evitadb.externalApi.api.model.PropertyDescriptor; | ||
|
||
import static io.evitadb.externalApi.api.model.ObjectPropertyDataTypeDescriptor.nullableRef; | ||
|
||
/** | ||
* Extension of {@link PriceDescriptor} specific for "price for sale" prices. | ||
* | ||
* @author Lukáš Hornych, FG Forrest a.s. (c) 2024 | ||
*/ | ||
public interface PriceForSaleDescriptor extends PriceDescriptor { | ||
|
||
PropertyDescriptor ACCOMPANYING_PRICE = PropertyDescriptor.builder() | ||
.name("accompanyingPrice") | ||
.description(""" | ||
Allows to calculate and return additional accompanying prices that relate to the selected price for sale | ||
and adhere to particular price inner record handling logic. | ||
""") | ||
.type(nullableRef(PriceDescriptor.THIS)) | ||
.build(); | ||
|
||
ObjectDescriptor THIS = ObjectDescriptor.extend(PriceDescriptor.THIS) | ||
.name("PriceForSale") | ||
.build(); | ||
} |
Oops, something went wrong.