Skip to content

Commit 210945a

Browse files
minor changes
1 parent a23420f commit 210945a

File tree

6 files changed

+81
-24
lines changed

6 files changed

+81
-24
lines changed

README.md

+57-17
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,8 @@ QuizMate is deployed on AWS EC2 using Docker containers, leveraging the scalabil
2525

2626
QuizApp is designed to provide the following key features:
2727

28-
- **Question Management:**
28+
- **Question Management & Quiz Crea
29+
- tion**
2930
- View a list of questions.
3031
- Create new questions.
3132
- Update existing questions.
@@ -54,10 +55,10 @@ QuizApp is designed to provide the following key features:
5455
QuizMate offers a wide range of features to meet your quiz and question management needs:
5556

5657
### Question Management:
57-
- **View Questions:** Users can view a list of questions stored in the system, including the question text, options, marks, and difficulty level. They can also perform CRUD operations on questions, such as adding, updating, and deleting them.
58-
- **Approval Workflow:** Any changes made to questions, including additions, updates, or deletions, are reflected in the system once they are approved by an admin. This ensures that only verified and accurate questions are available for use.
59-
- **Question Paper Generation:** Users can generate question papers with a combination of easy, medium, and hard questions from various topics. This feature allows for the creation of balanced and comprehensive question papers for exams or quizzes.
60-
- **Custom Quiz Creation:** Users can create custom quizzes by selecting questions based on their difficulty level and topic. This feature enables users to tailor quizzes to their specific needs and preferences, enhancing the quiz-taking experience.
58+
- **View Questions:** Users can view a list of questions stored in the system, including the question text, options, and correct answer.
59+
- **Create Questions:** Authenticated users can create new questions, specifying the question text, options, correct answer, and optional details like difficulty level and topic.
60+
- **Update Questions:** Users with the necessary permissions can edit existing questions to modify any details or correct errors.
61+
- **Delete Questions:** Authorized users can delete questions that are no longer needed.
6162

6263
### Topic Filtering:
6364
- **Filter by Topics:** Questions can be filtered based on predefined topics, allowing users to focus on specific areas of interest.
@@ -75,6 +76,14 @@ QuizMate offers a wide range of features to meet your quiz and question manageme
7576
- **Unique SessionUserID:** Each user participating in the session is personally identified with a unique sessionUserID, ensuring accurate tracking and identification.
7677
- **Session Reports:** A session report is generated and saved for the user who created the session, providing detailed insights into the session's performance and outcomes.
7778

79+
### Blog Features:
80+
- **Post Creation:** Users can create new posts to share their thoughts, ideas, and questions with the community. Posts can include text, images, and links, allowing for rich and engaging content.
81+
- **Like and Unlike:** Users can like posts to show their appreciation or agreement. They can also unlike posts if they change their mind or no longer wish to support a particular post.
82+
- **Commenting:** Users can comment on posts to share their thoughts, ask questions, or provide feedback. Comments can spark conversations and create a dialogue between users.
83+
84+
These features enrich the user experience on QuizMate, providing a platform for meaningful interactions and discussions within the community.
85+
86+
7887
### Google Vertex AI Integration:
7988
- **Hint Generation:** Google Vertex AI, specifically the Gemini Pro model, is used to generate hints for the questions. These hints can provide additional context or clues to help users answer questions correctly, enhancing the quiz experience.
8089

@@ -92,10 +101,10 @@ QuizMate offers a wide range of features to meet your quiz and question manageme
92101
- Spring Security
93102
- JWT authentication
94103
- MySQL Database
95-
- Cloudinary (For user profile image management)
96-
- AWS for Deployment
97-
- Github Actions for CI/CD pipeline
98-
- Docker for containerisation
104+
- Cloudinary
105+
- AWS for Deloyment
106+
- Github Actions
107+
- Docker
99108

100109
Add any other technologies or libraries you've used in your project.
101110

@@ -114,7 +123,6 @@ Before you begin, make sure you have the following installed:
114123

115124

116125

117-
118126
### Installation
119127

120128
1. Clone the repository:
@@ -123,8 +131,8 @@ Before you begin, make sure you have the following installed:
123131
git clone https://github.com/yourusername/quizApp_backend.git
124132
2. Configure application.properties:
125133
```shell
126-
# configure according to your requirement
127-
server.port=8080
134+
# configure according to your requirement
135+
server.port=8080
128136
spring.security.filter.order=3
129137
spring.datasource.url=url
130138
spring.datasource.username="username"
@@ -143,15 +151,17 @@ Before you begin, make sure you have the following installed:
143151
spring.mail.password=password
144152
spring.mail.properties.mail.smtp.auth=true
145153
spring.mail.properties.mail.smtp.starttls.enable=true
146-
147154
148155
3. Configure Cloudinary Configuration
149156
```shell
150157
config.put("cloud_name","");
151158
config.put("api_key","");
152159
config.put("api_secret","");
153-
config.put("sceure",true);
154-
160+
config.put("sceure",true);
161+
162+
## Configuration
163+
Configure application, including setting up the database and Cloudinary credentials & vertex Ai using Google Cloud SDK shell.
164+
155165
## Frontend
156166
The frontend for QuizMate is currently under development and is being contributed by the following developers:
157167

@@ -165,8 +175,36 @@ The frontend for QuizMate is currently under development and is being contribute
165175
Please note that the frontend is still in progress, and more details will be added once it is ready for deployment.
166176

167177

168-
### Configuration
169-
Configure application, including setting up the database and Cloudinary credentials & vertex Ai using Google Cloud SDK shell.
178+
## Deployment:
179+
- **AWS EC2 (Ubuntu OS):** QuizMate is deployed on AWS EC2 instances running Ubuntu OS. EC2 instances provide scalable compute capacity in the cloud, allowing QuizMate to handle varying loads efficiently.
180+
181+
- **AWS RDS (MySQL Database):** MySQL database hosted on AWS RDS is used for managing user profiles, quiz data, question data, and other application data. RDS provides a scalable and managed database solution, ensuring data reliability and performance.
182+
183+
- **Cloudinary:** QuizMate uses Cloudinary for storing media files, such as user profile images. Cloudinary provides a cloud-based media management platform, enabling efficient storage and delivery of media files.
184+
185+
- **Docker:** QuizMate is containerized using Docker, allowing for easy deployment and scalability. Docker containers encapsulate the application and its dependencies, ensuring consistent and reliable deployment across different environments.
186+
187+
- **GitHub Actions:** QuizMate uses GitHub Actions for creating a CI/CD pipeline. GitHub Actions automate the build, test, and deployment processes, ensuring rapid and reliable delivery of updates to the application.
188+
189+
## Key Points:
190+
1. **Custom Gateway Filter:** QuizMate uses a custom filter before the Spring Security filter to handle specific requirements or preprocessing of requests.
191+
192+
2. **Global CORS Configuration:** CORS (Cross-Origin Resource Sharing) is configured globally to allow requests from any origin. Preflight requests and AJAX calls are also properly configured with Spring Security.
193+
194+
3. **Mapping Types:** Various types of mappings are used throughout the project, including one-to-one, one-to-many, and many-to-many mappings, to establish relationships between entities.
195+
196+
4. **Global Exception Handling:** QuizMate implements a global exception handler along with a `@RestControllerAdvice` to effectively handle exceptions and provide proper information about errors to clients.
197+
198+
5. **Cloudinary SDK:** The Cloudinary SDK is used to handle media content, such as user profile images, ensuring efficient storage and delivery of media files.
199+
200+
6. **Mail Sender:** QuizMate uses a mail sender to send emails for verification and session details, enhancing the user experience and providing necessary information to users.
201+
202+
### Postman Collection (Work in Progress):
203+
A Postman collection is being developed to document and test the APIs of QuizMate. It will include endpoints for various functionalities such as user authentication, question management, quiz creation, and blog post interactions.
204+
205+
Please check back soon for the completed Postman collection, which will provide a comprehensive overview of QuizMate's API capabilities and allow for easy testing and integration with the application.
206+
207+
170208
171209
### Swagger API Documentation
172210
QuizApp provides Swagger for easy API documentation and testing. You can access the Swagger UI to interact with the APIs as follows:
@@ -175,3 +213,5 @@ http://65.2.175.178:8080/swagger-ui/index.html
175213
176214
```shell
177215
http://localhost:8080/swagger-ui.html
216+
217+

src/main/java/com/example/quizapp/QuizApp/Services/SessionService.java

+19-3
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,10 @@
1717
import org.springframework.beans.factory.annotation.Autowired;
1818
import org.springframework.stereotype.Service;
1919

20+
import java.time.Duration;
21+
import java.time.LocalDateTime;
22+
import java.time.ZoneId;
23+
import java.time.temporal.Temporal;
2024
import java.util.*;
2125
import java.util.stream.Collectors;
2226

@@ -46,6 +50,7 @@ public class SessionService {
4650
@Autowired
4751
ModelMapper modelMapper;
4852

53+
public record sessionMessage(String message, Long timeLeft){}
4954

5055
public SessionDTO createSession(SessionDTO sessionDTO) {
5156
List<QuestionDTO> updatedQuestionList=new ArrayList<>();
@@ -119,7 +124,7 @@ private Date calculateExpirationTime(int expirationTime) {
119124
return new Date(calendar.getTime().getTime());
120125
}
121126

122-
public SessionDTO getSessionDetails(Integer sessionId) {
127+
public Object getSessionDetails(Integer sessionId) {
123128
log.info(sessionId.toString());
124129
// log.info(sessionId);
125130
// if (sessionId.equals("all")) {
@@ -129,13 +134,24 @@ public SessionDTO getSessionDetails(Integer sessionId) {
129134
//Collections.singletonList(sessionDAO.findById(Integer.parseInt(sessionId)).get());
130135
if (!sessionDAO.existsById(sessionId)) {
131136
//throw exception
132-
throw new CustomException("Unable to find sessionDetails check the sessionId carefully");
137+
throw new CustomException("Session id not exist check the carefully");
138+
}
139+
140+
Session session=sessionDAO.findById(sessionId).get();
141+
142+
Date currTimeStamp=new Date();
143+
if(currTimeStamp.before(session.getStartTimeStamp())){
144+
// log.info("reach here");
145+
// Duration duration=Duration.between((Temporal) session.getStartTimeStamp(), (Temporal) currTimeStamp);
146+
LocalDateTime dateTime1 = session.getStartTimeStamp().toInstant().atZone(ZoneId.systemDefault()).toLocalDateTime();
147+
LocalDateTime dateTime2 = currTimeStamp.toInstant().atZone(ZoneId.systemDefault()).toLocalDateTime();
148+
return new sessionMessage("Session has not started yet !!",Duration.between(dateTime2,dateTime1).toMinutes() );
133149
}
134150

135151
//rank changes handle here
136152
// return Collections.singletonList(modelMapper.map(sessionDAO.findById(Integer.parseInt(sessionId)).get(), SessionDTO.class));
137153

138-
Session session=sessionDAO.findById(sessionId).get();
154+
139155
List<SessionUser> sessionUserListAttempted=new ArrayList<>();
140156
List<SessionUser> sessionUserListNonAttempted=new ArrayList<>();
141157
for(SessionUser sessionUser:session.getSessionUserList()){

src/main/java/com/example/quizapp/QuizApp/controller/SessionController.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ public ResponseEntity<Message> createSession(@RequestBody SessionDTO session){
4040
}
4141

4242
@GetMapping("/session/{sessionId}")
43-
public ResponseEntity<SessionDTO> getSessionDetails(@PathVariable Integer sessionId)
43+
public ResponseEntity<Object> getSessionDetails(@PathVariable Integer sessionId)
4444
{
4545
return new ResponseEntity<>(sessionService.getSessionDetails(sessionId),HttpStatus.OK);
4646
}

src/main/java/com/example/quizapp/QuizApp/entity/Session.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,10 @@ public class Session {
1818

1919
String dateAndTime ;
2020

21-
@JsonIgnore
21+
// @JsonIgnore
2222
Date startTimeStamp;
2323

24-
@JsonIgnore
24+
// @JsonIgnore
2525
Date expiryTimeStamp;
2626

2727
Integer delayDuration;

src/main/java/com/example/quizapp/QuizApp/model/QuestionDTO.java

+2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
package com.example.quizapp.QuizApp.model;
22

3+
import com.fasterxml.jackson.annotation.JsonIgnore;
34
import com.fasterxml.jackson.annotation.JsonProperty;
45
import lombok.Data;
56
import lombok.NoArgsConstructor;
@@ -16,6 +17,7 @@ public class QuestionDTO {
1617
String options4;
1718
@JsonProperty( access = JsonProperty.Access.WRITE_ONLY)
1819
String rightAnswer;
20+
@JsonIgnore
1921
Integer rightOption;
2022
String category;
2123
String topic;

src/main/resources/application.properties

-1
Original file line numberDiff line numberDiff line change
@@ -28,4 +28,3 @@ spring.mail.password=dyxwysgcrtlszoys
2828
spring.mail.properties.mail.smtp.auth=true
2929
spring.mail.properties.mail.smtp.starttls.enable=true
3030

31-
server.port=8000

0 commit comments

Comments
 (0)