Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
2
2023-191
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
2023-191
2023-191
Commits
7f2b5b6b
Commit
7f2b5b6b
authored
Aug 29, 2023
by
it20118068
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Update Backend
parent
3d73a085
Changes
15
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
15 changed files
with
558 additions
and
62 deletions
+558
-62
SpringBootBackend/src/main/java/shrasthra/backend/controller/ShrasthraBackendController.java
...asthra/backend/controller/ShrasthraBackendController.java
+37
-57
SpringBootBackend/src/main/java/shrasthra/backend/dao/domain/Lessons.java
...d/src/main/java/shrasthra/backend/dao/domain/Lessons.java
+57
-0
SpringBootBackend/src/main/java/shrasthra/backend/dao/domain/Quiz.java
...kend/src/main/java/shrasthra/backend/dao/domain/Quiz.java
+59
-0
SpringBootBackend/src/main/java/shrasthra/backend/dao/dto/LessonsDto.java
...d/src/main/java/shrasthra/backend/dao/dto/LessonsDto.java
+13
-0
SpringBootBackend/src/main/java/shrasthra/backend/dao/dto/McqWordDto.java
...d/src/main/java/shrasthra/backend/dao/dto/McqWordDto.java
+20
-0
SpringBootBackend/src/main/java/shrasthra/backend/dao/dto/ProcessRequestDto.java
...ain/java/shrasthra/backend/dao/dto/ProcessRequestDto.java
+3
-0
SpringBootBackend/src/main/java/shrasthra/backend/dao/dto/ProcessResponseDto.java
...in/java/shrasthra/backend/dao/dto/ProcessResponseDto.java
+10
-0
SpringBootBackend/src/main/java/shrasthra/backend/dao/dto/QuizDto.java
...kend/src/main/java/shrasthra/backend/dao/dto/QuizDto.java
+16
-0
SpringBootBackend/src/main/java/shrasthra/backend/repository/LessonsRepository.java
.../java/shrasthra/backend/repository/LessonsRepository.java
+16
-0
SpringBootBackend/src/main/java/shrasthra/backend/repository/McqWordRepository.java
.../java/shrasthra/backend/repository/McqWordRepository.java
+5
-1
SpringBootBackend/src/main/java/shrasthra/backend/repository/QuizRepository.java
...ain/java/shrasthra/backend/repository/QuizRepository.java
+16
-0
SpringBootBackend/src/main/java/shrasthra/backend/repository/SignMapRepository.java
.../java/shrasthra/backend/repository/SignMapRepository.java
+3
-0
SpringBootBackend/src/main/java/shrasthra/backend/service/i/ShrasthraBackendService.java
.../shrasthra/backend/service/i/ShrasthraBackendService.java
+8
-1
SpringBootBackend/src/main/java/shrasthra/backend/service/impl/ShrasthraBackendServiceImpl.java
...hra/backend/service/impl/ShrasthraBackendServiceImpl.java
+289
-1
SpringBootBackend/src/main/java/shrasthra/backend/util/common/REST_CONTROLLER_URL.java
...va/shrasthra/backend/util/common/REST_CONTROLLER_URL.java
+6
-2
No files found.
SpringBootBackend/src/main/java/shrasthra/backend/controller/ShrasthraBackendController.java
View file @
7f2b5b6b
...
...
@@ -17,6 +17,7 @@ import org.springframework.http.ResponseEntity;
import
org.springframework.util.LinkedMultiValueMap
;
import
org.springframework.util.MultiValueMap
;
import
org.springframework.web.bind.annotation.CrossOrigin
;
import
org.springframework.web.bind.annotation.RequestBody
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RequestMethod
;
import
org.springframework.web.bind.annotation.RequestParam
;
...
...
@@ -51,65 +52,44 @@ public class ShrasthraBackendController {
responseDto
=
backendService
.
audioToSign
(
file
);
return
responseDto
;
}
@RequestMapping
(
value
=
REST_CONTROLLER_URL
.
VIDEO_TO_SIGN
,
method
=
RequestMethod
.
POST
)
public
@ResponseBody
ProcessResponseDto
videoToSign
(
@RequestParam
(
"file"
)
MultipartFile
file
,
HttpServletRequest
request
){
ProcessResponseDto
responseDto
=
new
ProcessResponseDto
();
responseDto
=
backendService
.
videoToSign
(
file
);
return
responseDto
;
}
@RequestMapping
(
value
=
REST_CONTROLLER_URL
.
VOCAL_TRAINING
,
method
=
RequestMethod
.
POST
)
public
@ResponseBody
ProcessResponseDto
vocalTraining
(
@RequestParam
(
"file"
)
MultipartFile
file
,
HttpServletRequest
request
){
ProcessResponseDto
responseDto
=
new
ProcessResponseDto
();
responseDto
=
backendService
.
vocalTraining
(
file
);
return
responseDto
;
}
@RequestMapping
(
value
=
REST_CONTROLLER_URL
.
GET_ALL_LESSONS
,
method
=
RequestMethod
.
POST
)
public
@ResponseBody
ProcessResponseDto
getAllLessonsById
(
@RequestBody
ProcessRequestDto
processRequestDto
,
HttpServletRequest
request
){
ProcessResponseDto
responseDto
=
new
ProcessResponseDto
();
responseDto
=
backendService
.
getAllLessonsById
(
processRequestDto
);
return
responseDto
;
}
@RequestMapping
(
value
=
REST_CONTROLLER_URL
.
START_QUIZ
,
method
=
RequestMethod
.
POST
)
public
@ResponseBody
ProcessResponseDto
startQuiz
(
@RequestBody
ProcessRequestDto
processRequestDto
,
HttpServletRequest
request
){
ProcessResponseDto
responseDto
=
new
ProcessResponseDto
();
responseDto
=
backendService
.
startQuiz
(
processRequestDto
);
return
responseDto
;
}
@RequestMapping
(
value
=
REST_CONTROLLER_URL
.
GET_QUIZ
,
method
=
RequestMethod
.
POST
)
public
@ResponseBody
ProcessResponseDto
getQuizByUID
(
@RequestBody
ProcessRequestDto
processRequestDto
,
HttpServletRequest
request
){
ProcessResponseDto
responseDto
=
new
ProcessResponseDto
();
responseDto
=
backendService
.
getQuizByUID
(
processRequestDto
);
return
responseDto
;
}
@RequestMapping
(
value
=
REST_CONTROLLER_URL
.
GET_URL
,
method
=
RequestMethod
.
POST
)
public
@ResponseBody
ProcessResponseDto
getSignURL
(
@RequestBody
ProcessRequestDto
processRequestDto
,
HttpServletRequest
request
){
ProcessResponseDto
responseDto
=
new
ProcessResponseDto
();
responseDto
=
backendService
.
getSignURL
(
processRequestDto
);
return
responseDto
;
}
// @RequestMapping(value = REST_CONTROLLER_URL.DETECT_DYNAMIC_SIGN, method = RequestMethod.POST)
// public @ResponseBody ProcessResponseDto saveQuotation(@RequestParam("file") MultipartFile file, HttpServletRequest request){
// ProcessResponseDto responseDto = new ProcessResponseDto();
//
// // Check if the file is not empty and process it
// if (!file.isEmpty()) {
// try {
// // Convert the file to bytes
// byte[] fileBytes = file.getBytes();
//
//
// RestTemplate restTemplate = new RestTemplate();
//
// // Set the URL of your Python Flask API
// String url = "http://127.0.0.1:5000/api/data";
//
// // Create headers and set content type as multipart/form-data
// HttpHeaders headers = new HttpHeaders();
// headers.setContentType(MediaType.MULTIPART_FORM_DATA);
//
// // Create the request body with the file as a part
// MultiValueMap<String, Object> requestBody = new LinkedMultiValueMap<>();
// requestBody.add("fileData", new ByteArrayResource(fileBytes) {
// @Override
// public String getFilename() {
// return file.getOriginalFilename();
// }
// });
//
// // Create the request entity with headers and body
// HttpEntity<MultiValueMap<String, Object>> requestEntity = new HttpEntity<>(requestBody, headers);
//
// // Make the POST request to the second API
// ResponseEntity<ProcessResponseDto> response = restTemplate.exchange(url, HttpMethod.POST, requestEntity, ProcessResponseDto.class);
//
// // Retrieve the response body
// ProcessResponseDto responseBody = response.getBody();
//
// // Print the response
// System.out.println(responseBody.getSign());
//
//
// } catch (Exception e) {
//// return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).body("Failed to process the video file.");
// }
// } else {
//// return ResponseEntity.badRequest().body("No video file provided.");
// }
//
// return responseDto;
// }
}
SpringBootBackend/src/main/java/shrasthra/backend/dao/domain/Lessons.java
0 → 100644
View file @
7f2b5b6b
package
shrasthra.backend.dao.domain
;
import
javax.persistence.Column
;
import
javax.persistence.Entity
;
import
javax.persistence.GeneratedValue
;
import
javax.persistence.Id
;
import
javax.persistence.Table
;
import
static
javax
.
persistence
.
GenerationType
.
IDENTITY
;
@Entity
@Table
(
name
=
"lessons"
,
catalog
=
"shrasthra"
)
public
class
Lessons
{
private
Integer
id
;
private
Integer
lesson_id
;
private
String
content
;
private
String
img_url
;
@Id
@GeneratedValue
(
strategy
=
IDENTITY
)
@Column
(
name
=
"id"
,
unique
=
true
,
nullable
=
false
)
public
Integer
getId
()
{
return
id
;
}
public
void
setId
(
Integer
id
)
{
this
.
id
=
id
;
}
@Column
(
name
=
"lesson_id"
)
public
Integer
getLesson_id
()
{
return
lesson_id
;
}
public
void
setLesson_id
(
Integer
lesson_id
)
{
this
.
lesson_id
=
lesson_id
;
}
@Column
(
name
=
"content"
)
public
String
getContent
()
{
return
content
;
}
public
void
setContent
(
String
content
)
{
this
.
content
=
content
;
}
@Column
(
name
=
"image_url"
)
public
String
getImg_url
()
{
return
img_url
;
}
public
void
setImg_url
(
String
img_url
)
{
this
.
img_url
=
img_url
;
}
}
SpringBootBackend/src/main/java/shrasthra/backend/dao/domain/Quiz.java
0 → 100644
View file @
7f2b5b6b
package
shrasthra.backend.dao.domain
;
import
javax.persistence.Column
;
import
javax.persistence.Entity
;
import
javax.persistence.GeneratedValue
;
import
javax.persistence.Id
;
import
javax.persistence.Table
;
import
static
javax
.
persistence
.
GenerationType
.
IDENTITY
;
@Entity
@Table
(
name
=
"quiz"
,
catalog
=
"shrasthra"
)
public
class
Quiz
{
private
Integer
id
;
private
Integer
paper_i
;
private
Integer
userid
;
private
Integer
qid
;
private
Boolean
isCorrect
;
@Id
@GeneratedValue
(
strategy
=
IDENTITY
)
@Column
(
name
=
"id"
,
unique
=
true
,
nullable
=
false
)
public
Integer
getId
()
{
return
id
;
}
public
void
setId
(
Integer
id
)
{
this
.
id
=
id
;
}
public
Integer
getPaper_i
()
{
return
paper_i
;
}
public
void
setPaper_i
(
Integer
paper_i
)
{
this
.
paper_i
=
paper_i
;
}
public
Integer
getUserid
()
{
return
userid
;
}
public
void
setUserid
(
Integer
userid
)
{
this
.
userid
=
userid
;
}
public
Integer
getQid
()
{
return
qid
;
}
public
void
setQid
(
Integer
qid
)
{
this
.
qid
=
qid
;
}
public
Boolean
getIsCorrect
()
{
return
isCorrect
;
}
public
void
setIsCorrect
(
Boolean
isCorrect
)
{
this
.
isCorrect
=
isCorrect
;
}
}
SpringBootBackend/src/main/java/shrasthra/backend/dao/dto/LessonsDto.java
0 → 100644
View file @
7f2b5b6b
package
shrasthra.backend.dao.dto
;
import
lombok.Data
;
@Data
public
class
LessonsDto
{
private
Integer
id
;
private
Integer
lesson_id
;
private
String
content
;
private
String
img_url
;
}
SpringBootBackend/src/main/java/shrasthra/backend/dao/dto/McqWordDto.java
0 → 100644
View file @
7f2b5b6b
package
shrasthra.backend.dao.dto
;
import
lombok.Data
;
import
shrasthra.backend.dao.domain.McqWord
;
@Data
public
class
McqWordDto
{
// private Integer id;
// private String label;
// private String value;
// private String opt1;
// private String opt2;
// private String opt3;
// private String opt4;
private
McqWord
word
;
private
boolean
isCorrect
;
}
SpringBootBackend/src/main/java/shrasthra/backend/dao/dto/ProcessRequestDto.java
View file @
7f2b5b6b
...
...
@@ -5,4 +5,7 @@ import lombok.Data;
@Data
public
class
ProcessRequestDto
{
private
byte
[]
video
;
private
Integer
userID
;
private
Integer
lessonId
;
private
String
value
;
}
SpringBootBackend/src/main/java/shrasthra/backend/dao/dto/ProcessResponseDto.java
View file @
7f2b5b6b
package
shrasthra.backend.dao.dto
;
import
java.util.List
;
import
lombok.Data
;
import
shrasthra.backend.dao.domain.Lessons
;
import
shrasthra.backend.dao.domain.SignMap
;
@Data
...
...
@@ -9,4 +12,11 @@ public class ProcessResponseDto {
private
String
message
;
private
String
sign
;
private
SignMap
signMap
;
private
boolean
isValid
;
private
List
<
Lessons
>
lessons
;
private
List
<
QuizDto
>
quizDtoList
;
private
List
<
McqWordDto
>
mcqWordDtolist
;
private
String
value
;
private
String
url
;
}
SpringBootBackend/src/main/java/shrasthra/backend/dao/dto/QuizDto.java
0 → 100644
View file @
7f2b5b6b
package
shrasthra.backend.dao.dto
;
import
lombok.Data
;
import
shrasthra.backend.dao.domain.McqWord
;
@Data
public
class
QuizDto
{
private
Integer
id
;
private
Integer
paper_i
;
private
Integer
userid
;
private
Integer
qid
;
private
Boolean
isCorrect
;
private
McqWord
mcqWord
;
}
SpringBootBackend/src/main/java/shrasthra/backend/repository/LessonsRepository.java
0 → 100644
View file @
7f2b5b6b
package
shrasthra.backend.repository
;
import
java.util.List
;
import
org.springframework.data.jpa.repository.JpaRepository
;
import
org.springframework.data.jpa.repository.Query
;
import
org.springframework.data.repository.query.Param
;
import
shrasthra.backend.dao.domain.Lessons
;
public
interface
LessonsRepository
extends
JpaRepository
<
Lessons
,
Integer
>{
@Query
(
"SELECT l FROM Lessons l WHERE l.lesson_id=:lesson_id"
)
public
List
<
Lessons
>
findLessonsByLessonId
(
@Param
(
"lesson_id"
)
Integer
lesson_id
);
}
SpringBootBackend/src/main/java/shrasthra/backend/repository/McqWordRepository.java
View file @
7f2b5b6b
package
shrasthra.backend.repository
;
import
java.util.List
;
import
org.springframework.data.jpa.repository.JpaRepository
;
import
org.springframework.data.jpa.repository.Query
;
import
shrasthra.backend.dao.domain.McqWord
;
public
interface
McqWordRepository
extends
JpaRepository
<
McqWord
,
Integer
>{
@Query
(
value
=
"SELECT * FROM shrasthra.mcq_words ORDER BY RAND() LIMIT 2"
,
nativeQuery
=
true
)
public
List
<
McqWord
>
generateQuiz
();
}
SpringBootBackend/src/main/java/shrasthra/backend/repository/QuizRepository.java
0 → 100644
View file @
7f2b5b6b
package
shrasthra.backend.repository
;
import
java.util.List
;
import
org.springframework.data.jpa.repository.JpaRepository
;
import
org.springframework.data.jpa.repository.Query
;
import
org.springframework.data.repository.query.Param
;
import
shrasthra.backend.dao.domain.Quiz
;
public
interface
QuizRepository
extends
JpaRepository
<
Quiz
,
Integer
>{
@Query
(
"SELECT q FROM Quiz q WHERE q.userid=:uid"
)
public
List
<
Quiz
>
findQuizesByUid
(
@Param
(
"uid"
)
Integer
uid
);
}
SpringBootBackend/src/main/java/shrasthra/backend/repository/SignMapRepository.java
View file @
7f2b5b6b
...
...
@@ -10,4 +10,7 @@ public interface SignMapRepository extends JpaRepository<SignMap, Integer>{
@Query
(
"SELECT s FROM SignMap s WHERE s.label=:label"
)
public
SignMap
findSignMapByLabel
(
@Param
(
"label"
)
String
label
);
@Query
(
"SELECT s FROM SignMap s WHERE s.value=:value"
)
public
SignMap
findSignMapByValue
(
@Param
(
"value"
)
String
value
);
}
SpringBootBackend/src/main/java/shrasthra/backend/service/i/ShrasthraBackendService.java
View file @
7f2b5b6b
...
...
@@ -8,7 +8,14 @@ import shrasthra.backend.dao.dto.ProcessResponseDto;
public
interface
ShrasthraBackendService
{
public
ProcessResponseDto
detectDynamicSign
(
MultipartFile
file
);
public
ProcessResponseDto
audioToSign
(
MultipartFile
file
);
public
ProcessResponseDto
videoToSign
(
MultipartFile
file
);
public
ProcessResponseDto
vocalTraining
(
MultipartFile
file
);
public
ProcessResponseDto
getAllLessonsById
(
ProcessRequestDto
processRequestDto
);
public
ProcessResponseDto
startQuiz
(
ProcessRequestDto
processRequestDto
);
public
ProcessResponseDto
getQuizByUID
(
ProcessRequestDto
processRequestDto
);
public
ProcessResponseDto
getSignMapByValue
(
ProcessRequestDto
processRequestDto
);
public
ProcessResponseDto
getSignURL
(
ProcessRequestDto
processRequestDto
);
}
SpringBootBackend/src/main/java/shrasthra/backend/service/impl/ShrasthraBackendServiceImpl.java
View file @
7f2b5b6b
This diff is collapsed.
Click to expand it.
SpringBootBackend/src/main/java/shrasthra/backend/util/common/REST_CONTROLLER_URL.java
View file @
7f2b5b6b
...
...
@@ -4,9 +4,13 @@ public class REST_CONTROLLER_URL {
public
static
final
String
USER_REGISTRATION
=
"/user/userRegistration"
;
public
static
final
String
DETECT_DYNAMIC_SIGN
=
"/sign/detectDynamicSign"
;
public
static
final
String
AUDIO_TO_SIGN
=
"/sign/audioToSign"
;
public
static
final
String
VIDEO_TO_SIGN
=
"/sign/videoToSign"
;
public
static
final
String
VOCAL_TRAINING
=
"/sign/vocalTraining"
;
public
static
final
String
GET_ALL_LESSONS
=
"/lessons/getAllLessons"
;
public
static
final
String
START_QUIZ
=
"/quiz/startQuiz"
;
public
static
final
String
GET_QUIZ
=
"/quiz/getQuiz"
;
public
static
final
String
GET_URL
=
"/sign/getURL"
;
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment