Проверка на проект
Closed this issue · 6 comments
Здравейте. Бихте ли могли да ми погледнете проекта... имам още няколко неща за имплементиране, малко рефакторинг също... но основното вече е направено.
Благодаря!
https://github.com/Hristinchet0/GRTurboFullStackProject/tree/master
Здравей, ще се постарая да го погледна през уикенда, тъй като бях доста натоварен тези два дни.
Поздрави,
Л.
Благодаря!
Здравей!
Според мен проекта е напълно достатъчен откъм функционалности. Структуриран е ок и съдържа от почти всичко, което сме учили. Може би няколко неща та които да обърнеш внимание:
- Миграция към Boot 3, няма да е много трудно но може би ще е леко напрягащо :-) Има разлика в пакетите, някои конфигурационни пропъртита и в секюрити конфигурацията.
- Релациите между ентититата - според мен има прекалено много bi-directional релации, доста от тях са EAGER. Това не е необходимо, например не е необходимо да имаш UserEntitty да имаш шопинг карт и т.н. Показвам какви SQL queries се изпълняват, когато искаш да вземеш user-a по неговия email:
2023-10-28 09:15:22.604 DEBUG 6244 --- [nio-8080-exec-6] org.hibernate.SQL :
select
user0_.customer_id as customer1_8_,
user0_.address as address2_8_,
user0_.city as city3_8_,
user0_.email as email4_8_,
user0_.first_name as first_na5_8_,
user0_.last_name as last_nam6_8_,
user0_.password as password7_8_,
user0_.phone_number as phone_nu8_8_,
user0_.username as username9_8_
from
users user0_
where
user0_.email=?
2023-10-28 09:15:22.630 DEBUG 6244 --- [nio-8080-exec-6] org.hibernate.SQL :
select
invoicedat0_.id as id1_2_4_,
invoicedat0_.company_name as company_2_2_4_,
invoicedat0_.customer_id as customer8_2_4_,
invoicedat0_.financially_accountable_person_name as financia3_2_4_,
invoicedat0_.identification_number_uic as identifi4_2_4_,
invoicedat0_.phone_number as phone_nu5_2_4_,
invoicedat0_.registered_address as register6_2_4_,
invoicedat0_.vat_registration as vat_regi7_2_4_,
user1_.customer_id as customer1_8_0_,
user1_.address as address2_8_0_,
user1_.city as city3_8_0_,
user1_.email as email4_8_0_,
user1_.first_name as first_na5_8_0_,
user1_.last_name as last_nam6_8_0_,
user1_.password as password7_8_0_,
user1_.phone_number as phone_nu8_8_0_,
user1_.username as username9_8_0_,
orders2_.customer_id as custome10_4_6_,
orders2_.order_id as order_id1_4_6_,
orders2_.order_id as order_id1_4_1_,
orders2_.additional_information as addition2_4_1_,
orders2_.customer_id as custome10_4_1_,
orders2_.is_accept as is_accep3_4_1_,
orders2_.order_date as order_da4_4_1_,
orders2_.order_status as order_st5_4_1_,
orders2_.payment_method as payment_6_4_1_,
orders2_.quantity as quantity7_4_1_,
orders2_.tax as tax8_4_1_,
orders2_.total_price as total_pr9_4_1_,
roles3_.user_customer_id as user_cus1_9_7_,
userrole4_.id as roles_id2_9_7_,
userrole4_.id as id1_6_2_,
userrole4_.name as name2_6_2_,
shoppingca5_.shopping_cart_id as shopping1_7_3_,
shoppingca5_.customer_id as customer4_7_3_,
shoppingca5_.total_items as total_it2_7_3_,
shoppingca5_.total_price as total_pr3_7_3_
from
invoice_data invoicedat0_
left outer join
users user1_
on invoicedat0_.customer_id=user1_.customer_id
left outer join
orders orders2_
on user1_.customer_id=orders2_.customer_id
left outer join
users_roles roles3_
on user1_.customer_id=roles3_.user_customer_id
left outer join
roles userrole4_
on roles3_.roles_id=userrole4_.id
left outer join
shopping_cart shoppingca5_
on user1_.customer_id=shoppingca5_.customer_id
where
invoicedat0_.customer_id=?
2023-10-28 09:15:22.659 DEBUG 6244 --- [nio-8080-exec-6] org.hibernate.SQL :
select
shoppingca0_.shopping_cart_id as shopping1_7_6_,
shoppingca0_.customer_id as customer4_7_6_,
shoppingca0_.total_items as total_it2_7_6_,
shoppingca0_.total_price as total_pr3_7_6_,
cartitems1_.shopping_cart_id as shopping5_0_8_,
cartitems1_.id as id1_0_8_,
cartitems1_.id as id1_0_0_,
cartitems1_.product_id as product_4_0_0_,
cartitems1_.quantity as quantity2_0_0_,
cartitems1_.shopping_cart_id as shopping5_0_0_,
cartitems1_.total_price as total_pr3_0_0_,
product2_.product_id as product_1_5_1_,
product2_.brand as brand2_5_1_,
product2_.category_id as category7_5_1_,
product2_.description as descript3_5_1_,
product2_.img_url as img_url4_5_1_,
product2_.name as name5_5_1_,
product2_.order_order_id as order_or8_5_1_,
product2_.price as price6_5_1_,
user3_.customer_id as customer1_8_2_,
user3_.address as address2_8_2_,
user3_.city as city3_8_2_,
user3_.email as email4_8_2_,
user3_.first_name as first_na5_8_2_,
user3_.last_name as last_nam6_8_2_,
user3_.password as password7_8_2_,
user3_.phone_number as phone_nu8_8_2_,
user3_.username as username9_8_2_,
orders4_.customer_id as custome10_4_9_,
orders4_.order_id as order_id1_4_9_,
orders4_.order_id as order_id1_4_3_,
orders4_.additional_information as addition2_4_3_,
orders4_.customer_id as custome10_4_3_,
orders4_.is_accept as is_accep3_4_3_,
orders4_.order_date as order_da4_4_3_,
orders4_.order_status as order_st5_4_3_,
orders4_.payment_method as payment_6_4_3_,
orders4_.quantity as quantity7_4_3_,
orders4_.tax as tax8_4_3_,
orders4_.total_price as total_pr9_4_3_,
roles5_.user_customer_id as user_cus1_9_10_,
userrole6_.id as roles_id2_9_10_,
userrole6_.id as id1_6_4_,
userrole6_.name as name2_6_4_,
invoicedat7_.id as id1_2_5_,
invoicedat7_.company_name as company_2_2_5_,
invoicedat7_.customer_id as customer8_2_5_,
invoicedat7_.financially_accountable_person_name as financia3_2_5_,
invoicedat7_.identification_number_uic as identifi4_2_5_,
invoicedat7_.phone_number as phone_nu5_2_5_,
invoicedat7_.registered_address as register6_2_5_,
invoicedat7_.vat_registration as vat_regi7_2_5_
from
shopping_cart shoppingca0_
left outer join
cart_items cartitems1_
on shoppingca0_.shopping_cart_id=cartitems1_.shopping_cart_id
left outer join
products product2_
on cartitems1_.product_id=product2_.product_id
left outer join
users user3_
on shoppingca0_.customer_id=user3_.customer_id
left outer join
orders orders4_
on user3_.customer_id=orders4_.customer_id
left outer join
users_roles roles5_
on user3_.customer_id=roles5_.user_customer_id
left outer join
roles userrole6_
on roles5_.roles_id=userrole6_.id
left outer join
invoice_data invoicedat7_
on user3_.customer_id=invoicedat7_.customer_id
where
shoppingca0_.customer_id=?
2023-10-28 09:15:22.682 DEBUG 6244 --- [nio-8080-exec-6] org.hibernate.SQL :
select
category0_.category_id as category1_1_0_,
category0_.name as name2_1_0_
from
categories category0_
where
category0_.category_id=?
Представи си сега, че юзъра ти е редовен клиент :-)
- На някои места се прескачат някои layer, например категори сървиса връща ентитита.
- Има някои настройки, които са грешни, например:
spring.security.sql.init.mode=always
spring.security.servlet.multipart.max-file-size=10MB
spring.security.servlet.multipart.max-request-size=10MB
spring.security.mvc.hiddenmethod.filter.enabled=true
Тези не се намират в spring.security
- Не ми станаха ясни някои полета в DB - например защо в продуктите имаш ключ към ордърите.
- В контролерите на места има логика, чието място е в сървис, например
/add-to-cart
ендпойнта.
Вероятно има и други неща за дооправяне, но все пак е на път да стане готин проект.
Поздрави,
Л.
Благодаря. Настройките в properties файла ги оправих.
Може ли по конкретно за точка 6.В контролерите на места има логика, чието място е в сървис, например /add-to-cart ендпойнта.
Точка 5. Не ми станаха ясни някои полета в DB - например защо в продуктите имаш ключ към ордърите. -> Оправиг го... нещо по погрешка явно съм го добавила.
Мисля че ги пооправих тези неща, когато имате време, моля погледнете отново... Благодаря.
Здравей! Относно т.6 имах предвид, че може би в контролера се извикват прекалено много сървиси, вместо да се делегират тези неща към един. Но в конкретния случай може би не е фатално. Иначе ще го сваля пак и ще го разгледам довечера.