-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathparams.json
1 lines (1 loc) · 5.49 KB
/
params.json
1
{"name":"Qcounter","tagline":"","body":"# **Hey there. if you can see this page it means the qr code works!.**\r\n# Project Structure\r\n```\r\n qcounter\r\n ...\r\n ├── src\r\n ├── main\r\n │ ├── java\r\n │ │ └── com\r\n │ │ └── proximity\r\n │ │ └── labs\r\n │ │ └── qcounter\r\n │ │ ├── advice\r\n │ │ ├── annotation\r\n │ │ ├── cache\r\n │ │ ├── config\r\n │ │ ├── controllers\r\n │ │ ├── data\r\n │ │ │ ├── dto\r\n │ │ │ │ ├── request\r\n │ │ │ │ └── response\r\n │ │ │ ├── models\r\n │ │ │ │ ├── audit\r\n │ │ │ │ ├── token\r\n │ │ │ │ └── user\r\n │ │ │ └── repositories\r\n │ │ ├── event\r\n │ │ │ └── listener\r\n │ │ ├── exception\r\n │ │ ├── security\r\n │ │ ├── service\r\n │ │ └── util\r\n │ └── resources\r\n │ ├── static\r\n │ └── templates\r\n ...\r\n```\r\n# Project Structure Explained\r\n\r\n## ```com.proximy.labs.qcounter```\r\n\r\n#### ```.advice```\r\n\r\ncontains classes with methods to throw proper error message. this classes are grouped based on their purpose, like ```AuthControllerAdvice.java``` contains methods to throw auth related errors.\r\n\r\n#### ```.annotation```\r\n\r\ncontains files that combine annotations or create a new one.\r\n\r\n#### ```.cache```\r\n\r\n#### ```.config```\r\n\r\n#### ```.controllers```\r\n\r\n#### ```.event```\r\n\r\n#### ```.exception```\r\n\r\n#### ```.security```\r\n\r\nAll the packages above are self explanatory.\r\n\r\n#### ```.data```\r\n\r\n###### ```.dto```\r\n\r\ncontains classes used to exchange information client-server\r\n\r\n###### ```.models```\r\n\r\ncontains database entity classes and it's helpers.\r\n\r\n###### ```.repositories```\r\n\r\ncontains interface to write queries. each entity must have a repostory.\r\n\r\n###### ```.service```\r\n\r\ncontains classes to write bussiness logic, usually before making changes to db. but this can also be used to write any other bussiness logic that doesn't involes db.\r\n\r\n\r\n\r\n# Enpoint Documentations\r\n\r\n\r\n\r\n# FAQ\r\n\r\n1. where to query db?\r\n\r\n 1. create abstract query method in an entity respected repository interface.\r\n\r\n Example:\r\n\r\n```java\r\n public interface UserRepository extends JpaRepository<User, Long> {\r\n ...\r\n Optional<User> findByEmail(String email);\r\n ...\r\n }\r\n```\r\n\r\n 2. create a query method in an entity respected service class\r\n\r\n Example:\r\n\r\n```java\r\n public class UserService implements UserDetailsService{\r\n\r\n private static final Logger logger = Logger.getLogger(UserService.class);\r\n private final UserRepository userRepository;\r\n private final UserDeviceService userDeviceService;\r\n private final RefreshTokenService refreshTokenService;\r\n\r\n @Autowired\r\n public UserService(UserRepository userRepository, UserDeviceService userDeviceService, RefreshTokenService refreshTokenService) {\r\n this.userRepository = userRepository;\r\n this.userDeviceService = userDeviceService;\r\n this.refreshTokenService = refreshTokenService;\r\n }\r\n\r\n /**\r\n * Finds a user in the database by email\r\n */\r\n public Optional<User> findByEmail(String email) {\r\n return userRepository.findByEmail(email);\r\n }\r\n ...\r\n }\r\n```\r\n\r\n3. Inject the service class to where you need it. like in a controller class.\r\n\r\n Example on how to inject:\r\n\r\n ```java\r\n public class UserController {\r\n private static final Logger logger = Logger.getLogger(UserController.class);\r\n \r\n private final AuthService authService;\r\n \r\n private final UserService userService;\r\n \r\n private final ApplicationEventPublisher applicationEventPublisher;\r\n \r\n @Autowired\r\n public UserController(AuthService authService, UserService userService, ApplicationEventPublisher applicationEventPublisher) {\r\n this.authService = authService;\r\n this.userService = userService;\r\n this.applicationEventPublisher = applicationEventPublisher;\r\n }\r\n \r\n ```\r\n\r\n \t\t","note":"Don't delete this file! It's used internally to help with page regeneration."}