Commit 38d030f7 authored by Shaphen Pangburn's avatar Shaphen Pangburn

[whole team]: Successfully build and compile codebase with running server and...

[whole team]: Successfully build and compile codebase with running server and database with no values
parent 09ec63ac
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ExternalStorageConfigurationManager" enabled="true" />
<component name="ProjectRootManager" version="2" project-jdk-name="1.8" project-jdk-type="JavaSDK" />
<component name="ProjectRootManager" version="2" languageLevel="JDK_11" project-jdk-name="11" project-jdk-type="JavaSDK" />
</project>
\ No newline at end of file
......@@ -6,18 +6,16 @@ plugins {
group = 'com.nisum.attendance'
version = '0.0.1-SNAPSHOT'
sourceCompatibility = '11'
sourceCompatibility = '1.8'
repositories {
mavenCentral()
}
dependencies {
implementation 'org.springframework.boot:spring-boot-starter-data-mongodb'
implementation 'org.springframework.boot:spring-boot-starter-web'
implementation 'org.springframework.boot:spring-boot-starter-web-services'
runtimeOnly 'com.h2database:h2'
runtimeOnly 'org.postgresql:postgresql'
testImplementation 'org.springframework.boot:spring-boot-starter-test'
implementation 'org.springframework.boot:spring-boot-starter-data-jpa'
implementation 'org.springframework.boot:spring-boot-starter-actuator'
......
......@@ -12,7 +12,7 @@ import java.util.List;
@CrossOrigin(origins = "*")
@RestController
@RequestMapping("/api/")
@RequestMapping("/api")
public class AttendanceController {
@Autowired AttendanceService attendanceService;
......
......@@ -7,7 +7,6 @@ import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Table;
import java.util.Date;
import java.util.Hashtable;
@Entity
@Table(name = "attendance")
......@@ -17,31 +16,31 @@ public class Attendance {
private Long Id;
private Long studentId;
Date attendanceDate;
Hashtable<Date, Bool> attendedDates; // studentEmail = { date1 -> boolean, date2 -> boolean}
Bool didAttend;
public Long getStudentId() {
return studentId;
public Attendance(Date attendanceDate, Bool didAttend) {
this.attendanceDate = attendanceDate;
this.didAttend = didAttend;
}
public Attendance(Date attendanceDate, Hashtable<Date, Bool> attendedDates) {
this.attendanceDate = attendanceDate;
this.attendedDates = attendedDates;
public void setDidAttend(Bool didAttend) {
this.didAttend = didAttend;
}
public Date getAttendanceDate() {
return attendanceDate;
public Bool getDidAttend() {
return didAttend;
}
public void setAttendanceDate(Date attendanceDate) {
this.attendanceDate = attendanceDate;
public Long getStudentId() {
return studentId;
}
public Hashtable<Date, Bool> getAttendedDates() {
return attendedDates;
public Date getAttendanceDate() {
return attendanceDate;
}
public void setAttendedDates(Hashtable<Date, Bool> attendedDates) {
this.attendedDates = attendedDates;
public void setAttendanceDate(Date attendanceDate) {
this.attendanceDate = attendanceDate;
}
public Long getId() {
......
......@@ -31,7 +31,7 @@ public class AttendanceService {
public Attendance updateAttendance(Long attendanceId, Attendance attendanceDetails) {
Attendance attendance = getAttendanceById(attendanceId);
attendance.setAttendanceDate(attendanceDetails.getAttendanceDate());
attendance.setAttendedDates(attendanceDetails.getAttendedDates());
attendance.setDidAttend(attendanceDetails.getDidAttend());
return attendanceRepository.save(attendance);
}
}
spring.datasource.url=jdbc:h2:mem:dataSource
spring.datasource.driverClassName=org.h2.Driver
spring.datasource.username=sa
spring.datasource.password=
spring.datasource.schema=classpath:attendance.sql
spring.jpa.database-platform=org.hibernate.dialect.H2Dialect
spring.jpa.hibernate.ddl-auto=none
spring.h2.console.enabled=true
management.endpoint.beans.enabled=true
management.endpoints.web.exposure.include=*
server.port= 8090
info.app.name=Attendance
git server:
port: 8080
context-path: /
spring:
cloud:
config:
server:
health:
enabled: false
git:
force-pull: true
uri: https://gitlab.mynisum.com/rsayannagari/nisum-config-repo.git
searchPaths:
- nisum-test-service
logging:
pattern:
console: "[APP] %date{\"yyyy-MM-dd'T'HH:mm:ss,SSSXXX\"} [%thread] %-5level %logger{36} - %msg%n"
level:
root: INFO
#git server:
# port: 8081
# context-path: /
#spring:
# cloud:
# config:
# server:
# health:
# enabled: false
# git:
# force-pull: true
# uri: https://gitlab.mynisum.com/rsayannagari/nisum-config-repo.git
# searchPaths:
# - nisum-test-service
#logging:
# pattern:
# console: "[APP] %date{\"yyyy-MM-dd'T'HH:mm:ss,SSSXXX\"} [%thread] %-5level %logger{36} - %msg%n"
# level:
# root: INFO
# h2:
# console:
# enabled: true
# path: /h2
# datasource:
# url: jdbc:h2:file:~/test
# username: sa
# password:
# driverClassName: org.h2.Driver
\ No newline at end of file
DROP TABLE IF EXISTS ATTENDANCE;
CREATE TABLE ATTENDANCE (
ID INT AUTO_INCREMENT PRIMARY KEY,
STUDENT_ID INT NOT NULL,
ATTENDANCE_DATE DATE NOT NULL,
DID_ATTEND BOOLEAN DEFAULT FALSE
);
--CREATE TABLE tutorials_tbl (
-- id INT NOT NULL,
-- title VARCHAR(50) NOT NULL,
-- author VARCHAR(20) NOT NULL,
-- submission_date DATE
--);
--
--INSERT INTO ATTENDANCE VALUES
-- (1, 10, 0001-02-01, true),
-- (2, 20, 0001-02-02, false),
-- (3, 30, 0001-02-03, true),
-- (4, 30, 0001-02-04, true),
-- (5, 20, 0001-02-03, true),
-- (6, 10, 0001-02-02, false),
-- (7, 10, 0001-02-03, true),
-- (8, 30, 0001-02-05, true),
-- (9, 10, 0001-02-04, false);
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment