r/SpringBoot • u/Formal_Hippo8991 • Dec 30 '24
Full Stack Web Application - Spring, Angular and MySQL
Hello guys,
Hope your are all good. I'm posting on reddit because i'm developing for a while a Full Stack Application, using Spring, Angular and MySQL.
The goal of this application, is to manage all the eletronic equipments of a company and track each equipment (history).
So, i'm also seeking for a job as a dev and i thought this could be a good idea to rich my portfolio experience, since i have none.
So the main goal of the application is:
- User
- Add User
- We can create a user assigning him to a department, location or neither
- Edit User
- Delete User
- View Equipments
- Assign user to an equipment or multiple equipments
- Equiment
- Add Equipment
- We can create a equipmentssigning him to a department, location or neither
- Edit Equipment
- Delete Equipment
- View User owner
- Assign an equipment to an user
This are the main features at the moment, of this application. Later i will do improvements such as:
- Add Spring Security (Implementation of JWT Authentication and Login)
- Add a dashboard for admin, shoqwing cards with stats or graphs (Equipments p/department, Total of Users, Users p/department, Equipment p/status, etc...)
- Implement a notification system, to alert the admin the equipments that are on use or returned from the warranty.
Please, i would love some feedback from you, and i don't mind if my code it's not the best but the logic is there. If u have any thoughts ply don't mind to ask.
All i need is your opinions, improvements, or something i might be doing wrong.
I'm excited to hear from you guys !
Here goes my git hub repo: https://github.com/programtiago/management-app
Wish you the best,
Tiago
4
Dec 30 '24 edited Apr 17 '26
Stop letting data brokers profit from your old posts. I used Redact to wipe mine from Reddit. Also supports Twitter, Facebook, Discord, instagram and more in one batch.
squash quickest entertain smell person include silky sulky pot water
2
u/WaferIndependent7601 Dec 30 '24
Java 17 is LTS
1
u/Formal_Hippo8991 Dec 30 '24
So, i will keep with that ! Thanks again
2
u/WaferIndependent7601 Dec 30 '24
Changing it is just one line and you could use the newer features. But it’s up to you. I like to use the newest lts version
1
2
Dec 30 '24 edited Apr 17 '26
Redact decided this post had to go, so away it went. Deleted. Removed. Mass deleted even. Privacy and security are the big wins here.
friendly decide relieved gold cable innate spotted jellyfish history compare
1
u/Formal_Hippo8991 Dec 30 '24
I will take notes and study more. This is way too far to be completed :D
By the way, if you don't mind, how can i put my project in a way more atracctive to the recruiters ?
2
Dec 30 '24 edited Apr 17 '26
Scrubbed clean. Redact helped me bulk remove years of comments and posts so data brokers and AI crawlers have nothing to feast on.
tease afterthought encourage employ waiting tender roll sand label grey
1
u/Formal_Hippo8991 Dec 30 '24
Right ! I was about to do that, but only on the very final of the project. I was thinking too make the UML Diagram too have a view of the classes and to understand the relationships between entitys.
2
Dec 30 '24 edited Apr 17 '26
I used Redact to automate removals from databrokers and social networks. This post was among the batch deleted.
salt rustic steep label connect modern selective jeans wide pot
2
u/Formal_Hippo8991 Dec 30 '24
As I said, i have to explore mate. The dev community is awesome ! I will take a look and i will post updates.
1
u/GR-Dev-18 Dec 31 '24 edited Dec 31 '24
Sir can u say where I should add response entity
1
Dec 31 '24 edited Apr 17 '26
Data Brokers don't stand a chance because I mass delete all of my content using Redact - No AI training on my data, thank you very much.
governor meadow late include swim person spoon grey middle observation
1
u/GR-Dev-18 Dec 31 '24
Sorry, auto correct 😞, anyway thank you
1
Dec 31 '24 edited Apr 17 '26
If you're reading this, the original post got nuked by Redact. I use it to automatically purge my digital footprint from social networks, people search sites and messaging apps.
jar ten test include point sophisticated angle roof simplistic bedroom
3
2
u/Mikey-3198 Dec 30 '24
The handling of not founds is inconsistent. In the DepartmentController there is 3 ways your currently doing this
1 - Returning a list & checking isEmpty then throwing Exception (more on this below)
2 - Returning a null then throwing a ResourceNotFoundException
3 - Catching a ResourceNotFoundException that's thrown by the service then a 404 via a response entity.
I'd look at making this consistent. My preference would be to return an optional from the relevant services then return a ResponseEntity, 404 if its empty or 200 if the action succeeded. Key thing is that this is consistent otherwise it creates a lot of noise.
The endpoints can also be improved to make them more restful. The /all endpoint will throw an exception if getAllDepartments isEmpty. I’d expect this endpoint to simply return an empty list with a HTTP 200, no need to check for empty or throw an exception. Perfectly fine to return an empty collection if no resources exist. I’d also expect this endpoint to just be GET /api/v1/departments i.e no need for “/all” in the route.
Naming wise to create a new resource I'd expect a POST to /api/v1/departments. No need for “/new”.
1
u/Formal_Hippo8991 Dec 30 '24
Thanks u/Mikey-3198 for your reply. You're right, i did a mess on the exceptions and maybe create too much noise on the backend, wich can affect the performance of the responses coming from server. Anyway, thank you for the tips mate :)
2
2
u/WaferIndependent7601 Jan 02 '25
So you added your first Test - good start.
Some additions:
Do you unserstand what Transactional does on Tests?
public not needed on tests (this would be found by sonarqube)
Use assertJ, it's easier to use and you can use better methods.
One test does nothing.
1
u/Formal_Hippo8991 Jan 02 '25
From what I read, the behavior of Transactional is the “isolation” for a specific test, its transaction but alone. This can be multiples operations on DB and like this we allow the rollback. Am i right ? I assume that isn’t needed. One Test does nothing what you mean ? I know I can have multiple tests scenarios, right ?
1
u/Formal_Hippo8991 Jan 02 '25
Oh i got it ! U saw the commit that had just one test implementation for getting all users… right !
15
u/WaferIndependent7601 Dec 30 '24
Tests are missing
As usual: don't put Controllers in Controller package
DepartmentController:
you're mixing Optionals and nulls
getById calls departmentService.getById twice
Throwing an Exception will result in a 500. When no department is found you should return a 404
If you have only one Implementation, don't create an Interface. Espacially when you're not even using the Interface (DepartmentServiceImpl departmentService)
EquipmentController:
getting all equipment should (and will) return an empty list when no equipment is present. That's why you should write tests!
getById: if id is null you'll get an error (and you're calling the service twice again)
Equipment:
private String type; //SCANNER, SCREEN, MOUSE, DESKTOP
Why don't you use an enum here?
Same for the other Strings
This class is an entity but you're also using it as DTO
I think you will find several bugs when you start writing tests. The tests can be easy, just do end to end tests.
You should also use flyway or liquibase to create your tables.
Install SonarQube plugin and you will find several other small issues.
Postgres is always better than mysql. Use Postgres if possible.