diff --git a/HANDIN.md b/HANDIN.md new file mode 100644 index 00000000..263cd249 --- /dev/null +++ b/HANDIN.md @@ -0,0 +1,44 @@ +# HANDIN for Git Collaboration Exercise + +## Links to PR-s: +- [PR 1] https://github.com/taltech-vanemarendajaks/borsibaar-team12/pull/1 +- [PR 2] https://github.com/taltech-vanemarendajaks/borsibaar-team12/pull/2 +- [PR 3] https://github.com/taltech-vanemarendajaks/borsibaar-team12/pull/3 (CLOSED) +- [PR 4] https://github.com/taltech-vanemarendajaks/borsibaar-team12/pull/4 (CLOSED) +- [PR 5] https://github.com/taltech-vanemarendajaks/borsibaar-team12/pull/5 +- [PR 6] https://github.com/taltech-vanemarendajaks/borsibaar-team12/pull/6 +- [PR 7] https://github.com/taltech-vanemarendajaks/borsibaar-team12/pull/7 +- [PR 8] https://github.com/taltech-vanemarendajaks/borsibaar-team12/pull/8 (CLOSED) +- [PR 9] https://github.com/taltech-vanemarendajaks/borsibaar-team12/pull/9 (CLOSED) +- [PR 10] https://github.com/taltech-vanemarendajaks/borsibaar-team12/pull/10 +- [PR 11] https://github.com/taltech-vanemarendajaks/borsibaar-team12/pull/11 +- [PR 12] https://github.com/taltech-vanemarendajaks/borsibaar-team12/pull/12 (CLOSED) +- [PR 13] https://github.com/taltech-vanemarendajaks/borsibaar-team12/pull/13 +- [PR 14] https://github.com/taltech-vanemarendajaks/borsibaar-team12/pull/14 (CLOSED) +- [PR 15] https://github.com/taltech-vanemarendajaks/borsibaar-team12/pull/15 +- [PR 16] https://github.com/taltech-vanemarendajaks/borsibaar-team12/pull/16 +- [PR 17] https://github.com/taltech-vanemarendajaks/borsibaar-team12/pull/17 +- [PR 18] https://github.com/taltech-vanemarendajaks/borsibaar-team12/pull/18 +- [PR 19] https://github.com/taltech-vanemarendajaks/borsibaar-team12/pull/19 + +## What each team member worked on +Each teammember worked on creating feature branches, making commits and pull requests. + +We collaborated on .md files, intentionally created conflicts, and resolved them. We also experimented with different merge strategies using the VS Code terminal. + +## Explanation of the conflict you had and how it was resolved + +During our collaboration, we encountered several merge conflicts while working on the same TEAM.md file. +For instance, two team members edited the same section of a file simultaneously, leading to a conflict when merging their changes. + +## Strategies used to merge: +Made in terminal, as well as in Github web interface: + +* a regular merge commit - just to commit sth +* a squash merge - to take some commits together into one +* a rebase-based merge - to keep history straight line + +Just to see how they differ in the commit history, and to practice using different methods. + +![2-1.png](public/team12_pictures/2_1.png) +![2-6.png](public/team12_pictures/2_6.png) diff --git a/TEAM.md b/TEAM.md new file mode 100644 index 00000000..0c039cff --- /dev/null +++ b/TEAM.md @@ -0,0 +1,55 @@ +# TalTech course "Vanemarendajaks 2026" + +## Teamname: +- Team-12 + +## Team-members: + +- Eleri (ellucy) +- Katlin (kat-lin) +- Mari (marisaarevali) +- Tiit (eriktiit) +- Mihkel (vahermihkel) + +## Team Workflow Description + +### Branching strategy to organize collaboration + +**Main branches:** + +* main – holds the final production-ready version. + +* develop – integration branch for all completed features before final merge to main. + +**Feature branches:** + +* Each team member created (or creates) their own branch from develop, e.g., feature/homework1-katlin. +* All feature development has been (and will be) done in these isolated branches. + +**Code review rules:** + +* Before merging into develop, each team member creates a pull request. +* Another team member reviews the code and provides feedback or approval. + +## Team description: +We are a diverse group of individuals with a shared passion for technology and innovation. +Our team combines expertise in software development, design, and project management to deliver high-quality solutions. +We value collaboration, creativity, and continuous learning, striving to push the boundaries of what's possible in our projects. + +Tere Maailm! +Hello world! + +## Which merge strategies you used + +We used all three strategies: +* regular merge +* squash merge +* rebase merge + +## Why we chose them + +We wanted to try them all for practice + +## What problems you encountered + +We had a lot of conflicts and mistakes by making pull requests to the wrong branches. diff --git a/backend/src/main/java/com/borsibaar/service/SalesService.java b/backend/src/main/java/com/borsibaar/service/SalesService.java index 02c9d5f7..5f8e1fba 100644 --- a/backend/src/main/java/com/borsibaar/service/SalesService.java +++ b/backend/src/main/java/com/borsibaar/service/SalesService.java @@ -1,10 +1,8 @@ package com.borsibaar.service; import com.borsibaar.dto.*; -import com.borsibaar.entity.Category; -import com.borsibaar.entity.Inventory; -import com.borsibaar.entity.InventoryTransaction; -import com.borsibaar.entity.Product; +import com.borsibaar.entity.*; +import com.borsibaar.repository.BarStationRepository; import com.borsibaar.repository.InventoryRepository; import com.borsibaar.repository.InventoryTransactionRepository; import com.borsibaar.repository.ProductRepository; @@ -28,6 +26,7 @@ public class SalesService { private final InventoryRepository inventoryRepository; private final InventoryTransactionRepository inventoryTransactionRepository; private final ProductRepository productRepository; + private final BarStationRepository barStationRepository; @Transactional public SaleResponseDto processSale(SaleRequestDto request, UUID userId, Long organizationId) { @@ -37,10 +36,16 @@ public SaleResponseDto processSale(SaleRequestDto request, UUID userId, Long org List saleItems = new ArrayList<>(); BigDecimal totalAmount = BigDecimal.ZERO; + BarStation station = barStationRepository + .findByOrganizationIdAndId(organizationId, request.barStationId()) + .orElseThrow(() -> new ResponseStatusException( + HttpStatus.FORBIDDEN, + "Bar station does not belong to your organization")); + // Process each item in the sale for (SaleItemRequestDto item : request.items()) { SaleItemResponseDto saleItem = processSaleItem(item, userId, organizationId, saleId, - request.barStationId()); + station.getId()); saleItems.add(saleItem); totalAmount = totalAmount.add(saleItem.totalPrice()); } diff --git a/frontend/package-lock.json b/frontend/package-lock.json index 61dae07c..deafd1bc 100644 --- a/frontend/package-lock.json +++ b/frontend/package-lock.json @@ -19,7 +19,7 @@ "clsx": "^2.1.1", "d3": "^7.9.0", "lucide-react": "^0.544.0", - "next": "^15.5.7", + "next": "^15.5.9", "react": "^19.1.1", "react-dom": "^19.2.1", "swr": "^2.3.6", @@ -849,9 +849,9 @@ } }, "node_modules/@next/env": { - "version": "15.5.7", - "resolved": "https://registry.npmjs.org/@next/env/-/env-15.5.7.tgz", - "integrity": "sha512-4h6Y2NyEkIEN7Z8YxkA27pq6zTkS09bUSYC0xjd0NpwFxjnIKeZEeH591o5WECSmjpUhLn3H2QLJcDye3Uzcvg==", + "version": "15.5.9", + "resolved": "https://registry.npmjs.org/@next/env/-/env-15.5.9.tgz", + "integrity": "sha512-4GlTZ+EJM7WaW2HEZcyU317tIQDjkQIyENDLxYJfSWlfqguN+dHkZgyQTV/7ykvobU7yEH5gKvreNrH4B6QgIg==", "license": "MIT" }, "node_modules/@next/eslint-plugin-next": { @@ -2088,6 +2088,66 @@ "node": ">=14.0.0" } }, + "node_modules/@tailwindcss/oxide-wasm32-wasi/node_modules/@emnapi/core": { + "version": "1.6.0", + "dev": true, + "inBundle": true, + "license": "MIT", + "optional": true, + "dependencies": { + "@emnapi/wasi-threads": "1.1.0", + "tslib": "^2.4.0" + } + }, + "node_modules/@tailwindcss/oxide-wasm32-wasi/node_modules/@emnapi/runtime": { + "version": "1.6.0", + "dev": true, + "inBundle": true, + "license": "MIT", + "optional": true, + "dependencies": { + "tslib": "^2.4.0" + } + }, + "node_modules/@tailwindcss/oxide-wasm32-wasi/node_modules/@emnapi/wasi-threads": { + "version": "1.1.0", + "dev": true, + "inBundle": true, + "license": "MIT", + "optional": true, + "dependencies": { + "tslib": "^2.4.0" + } + }, + "node_modules/@tailwindcss/oxide-wasm32-wasi/node_modules/@napi-rs/wasm-runtime": { + "version": "1.0.7", + "dev": true, + "inBundle": true, + "license": "MIT", + "optional": true, + "dependencies": { + "@emnapi/core": "^1.5.0", + "@emnapi/runtime": "^1.5.0", + "@tybys/wasm-util": "^0.10.1" + } + }, + "node_modules/@tailwindcss/oxide-wasm32-wasi/node_modules/@tybys/wasm-util": { + "version": "0.10.1", + "dev": true, + "inBundle": true, + "license": "MIT", + "optional": true, + "dependencies": { + "tslib": "^2.4.0" + } + }, + "node_modules/@tailwindcss/oxide-wasm32-wasi/node_modules/tslib": { + "version": "2.8.1", + "dev": true, + "inBundle": true, + "license": "0BSD", + "optional": true + }, "node_modules/@tailwindcss/oxide-win32-arm64-msvc": { "version": "4.1.17", "resolved": "https://registry.npmjs.org/@tailwindcss/oxide-win32-arm64-msvc/-/oxide-win32-arm64-msvc-4.1.17.tgz", @@ -6235,12 +6295,12 @@ "license": "MIT" }, "node_modules/next": { - "version": "15.5.7", - "resolved": "https://registry.npmjs.org/next/-/next-15.5.7.tgz", - "integrity": "sha512-+t2/0jIJ48kUpGKkdlhgkv+zPTEOoXyr60qXe68eB/pl3CMJaLeIGjzp5D6Oqt25hCBiBTt8wEeeAzfJvUKnPQ==", + "version": "15.5.9", + "resolved": "https://registry.npmjs.org/next/-/next-15.5.9.tgz", + "integrity": "sha512-agNLK89seZEtC5zUHwtut0+tNrc0Xw4FT/Dg+B/VLEo9pAcS9rtTKpek3V6kVcVwsB2YlqMaHdfZL4eLEVYuCg==", "license": "MIT", "dependencies": { - "@next/env": "15.5.7", + "@next/env": "15.5.9", "@swc/helpers": "0.5.15", "caniuse-lite": "^1.0.30001579", "postcss": "8.4.31", diff --git a/frontend/package.json b/frontend/package.json index 2b964671..a70e403e 100644 --- a/frontend/package.json +++ b/frontend/package.json @@ -20,7 +20,7 @@ "clsx": "^2.1.1", "d3": "^7.9.0", "lucide-react": "^0.544.0", - "next": "^15.5.7", + "next": "^15.5.9", "react": "^19.1.1", "react-dom": "^19.2.1", "swr": "^2.3.6", diff --git a/public/team12_pictures/2_1.png b/public/team12_pictures/2_1.png new file mode 100644 index 00000000..3904daea Binary files /dev/null and b/public/team12_pictures/2_1.png differ diff --git a/public/team12_pictures/2_2.png b/public/team12_pictures/2_2.png new file mode 100644 index 00000000..63ff8da5 Binary files /dev/null and b/public/team12_pictures/2_2.png differ diff --git a/public/team12_pictures/2_3.png b/public/team12_pictures/2_3.png new file mode 100644 index 00000000..9f0c61b1 Binary files /dev/null and b/public/team12_pictures/2_3.png differ diff --git a/public/team12_pictures/2_4.png b/public/team12_pictures/2_4.png new file mode 100644 index 00000000..c8a310c6 Binary files /dev/null and b/public/team12_pictures/2_4.png differ diff --git a/public/team12_pictures/2_5.png b/public/team12_pictures/2_5.png new file mode 100644 index 00000000..fad52b54 Binary files /dev/null and b/public/team12_pictures/2_5.png differ diff --git a/public/team12_pictures/2_6.png b/public/team12_pictures/2_6.png new file mode 100644 index 00000000..4666b2de Binary files /dev/null and b/public/team12_pictures/2_6.png differ