Skip to content
Snippets Groups Projects
Commit d84f1bac authored by harryTheWizzard's avatar harryTheWizzard
Browse files

added product model and repo

parent 9f210d30
No related branches found
No related tags found
No related merge requests found
package ntnu.idatt2016.v233.SmartMat.model.product;
/**
* Product is a record class representing a product in the system.
* All other info about the product is fetched from api call on fronted.
* this ensures that the product is always up to date.
* @author Birk
* @version 1.0
* @since 04.04.2023
*/
public record Product (int ean, String name, String description){
}
package ntnu.idatt2016.v233.SmartMat.repository;
import ntnu.idatt2016.v233.SmartMat.model.ShoppingList;
import ntnu.idatt2016.v233.SmartMat.model.product.Product;
import java.util.List;
import java.util.Optional;
/**
* Repository for Products
* @author Birk
* @version 1.0
* @since 04.04.2023
*/
public interface ProductRepository {
/**
* Saves a Product to the database
*
* @param product Product to save
*/
Product save (Product product);
/**
* Gets a Product by its ID
*
* @param id the ID of the product
* @return an optional containing the product if it exists
*/
Optional<Product> getById(int id);
/**
* Gets a Product by name
*
* @param id the ID of the group
* @return an optional containing the product if it exists
*/
Optional<Product> getByProductName(int id);
/**
* Gets all Products
*
* @return an optional containing a list of all products
*/
Optional<List<Product>> getAll();
/**
* Deletes a product by its ID
*
* @param id the ID of the Product
*/
void deleteById(int id);
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment