diff --git a/gradle.properties b/gradle.properties new file mode 100644 index 0000000000000000000000000000000000000000..263735322c65c0369676f8f1e1a9b68a16a503e3 --- /dev/null +++ b/gradle.properties @@ -0,0 +1,4 @@ +version=1.0 + +license=https://cecill.info/licences/Licence_CeCILL-B_V1-fr.html +netbeans.license=cecill-b diff --git a/src/main/java/fr/unistra/sil/erp/back/api/controller/ApiRetrieveInfoController.java b/src/main/java/fr/unistra/sil/erp/back/api/controller/ApiRetrieveInfoController.java new file mode 100644 index 0000000000000000000000000000000000000000..aa3e6e96e03140b6b948986a226756f906723aad --- /dev/null +++ b/src/main/java/fr/unistra/sil/erp/back/api/controller/ApiRetrieveInfoController.java @@ -0,0 +1,27 @@ +/* + * CONTRAT DE LICENCE DE LOGICIEL LIBRE CeCILL-B + * https://cecill.info/licences/Licence_CeCILL-B_V1-fr.html + */ +package fr.unistra.sil.erp.back.api.controller; + +import fr.unistra.sil.erp.back.api.model.Item; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.RestController; + +/** + * REST controller for the item list. + * @author BEAUVAIS ANTOINE <antoine.beauvais@etu.unistra.fr> + */ +@RestController +public class ApiRetrieveInfoController { + + /** + * Returns an Item as a JSON response. + * @return an Item. + */ + @GetMapping("/erp-back/api/v1/retrieveInfo") + public Item retrieveInfo() + { + return new Item(1, "Test", 1.0, 0.5); + } +} diff --git a/src/main/java/fr/unistra/sil/erp/back/api/model/Item.java b/src/main/java/fr/unistra/sil/erp/back/api/model/Item.java new file mode 100644 index 0000000000000000000000000000000000000000..3657fc41a2fd0926652a667782d24c0414830d0b --- /dev/null +++ b/src/main/java/fr/unistra/sil/erp/back/api/model/Item.java @@ -0,0 +1,84 @@ +/* + * CONTRAT DE LICENCE DE LOGICIEL LIBRE CeCILL-B + * https://cecill.info/licences/Licence_CeCILL-B_V1-fr.html + */ +package fr.unistra.sil.erp.back.api.model; + +/** + * Item description. + * @author BEAUVAIS ANTOINE <antoine.beauvais@etu.unistra.fr> + */ +public class Item { + + /** + * The product's reference number. + */ + private final int ref; + + /** + * The product's name. + */ + private final String name; + + /** + * The product's regular price. + */ + private final double price; + + /** + * The product's price for subscribers. + */ + private final double subscriberPrice; + + /** + * Class constructor. + * @param ref The item's reference number. + * @param name The item's name. + * @param price The item's price. + * @param subscriberPrice The item's price for subscribers. + */ + public Item(int ref, String name, double price, + double subscriberPrice) + { + this.ref = ref; + this.name = name; + this.price = price; + this.subscriberPrice = subscriberPrice; + } + + /** + * Returns the current item's reference number. + * @return the reference number. + */ + public int getRef() + { + return this.ref; + } + + /** + * Returns the current item's name. + * @return the name. + */ + public String getName() + { + return this.name; + } + + /** + * Returns the current item's price. + * @return the price. + */ + public double getPrice() + { + return this.price; + } + + /** + * Returns the current item's price for subscribers. + * @return the price for subscribers. + */ + public double getSubscriberPrice() + { + return this.subscriberPrice; + } +}