Skip to content
Snippets Groups Projects
Commit 45b43706 authored by Dominika Zemanovičová's avatar Dominika Zemanovičová
Browse files

Use endpoints for database seed and drop

parent fb725fbc
No related branches found
No related tags found
1 merge request!34M3 data initialization
Pipeline #
Showing
with 533 additions and 241 deletions
package org.fuseri.modulecertificate.datainitializer;
import org.fuseri.modulecertificate.Certificate;
import org.fuseri.modulecertificate.service.CertificateRepository;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import java.time.Instant;
import java.util.List;
@Component
public class DataInitializer {
private final CertificateRepository certificateRepository;
@Autowired
public DataInitializer(CertificateRepository certificateRepository) {
this.certificateRepository = certificateRepository;
}
public void drop() {
certificateRepository.deleteAll();
}
public void initialize() {
drop();
Certificate c1 = new Certificate(7L, Instant.parse("2023-04-12T10:30:00Z"), 2L, "certificate_file_1.pdf", "Certificate for Course English A1");
Certificate c2 = new Certificate(7L, Instant.parse("2023-04-17T14:15:00Z"), 3L, "certificate_file_3.pdf", "Certificate for Course English A2");
Certificate c3 = new Certificate(9L, Instant.parse("2023-04-23T14:15:00Z"), 3L, "certificate_file_4.pdf", "Certificate for Course English A2");
Certificate c4 = new Certificate(7L, Instant.parse("2023-04-28T14:15:00Z"), 4L, "certificate_file_5.pdf", "Certificate for Course English B1");
Certificate c5 = new Certificate(9L, Instant.parse("2023-04-29T14:15:00Z"), 4L, "certificate_file_6.pdf", "Certificate for Course English B1");
certificateRepository.saveAll(List.of(c1, c2, c3, c4, c5));
}
}
package org.fuseri.modulecertificate.datainitializer;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.responses.ApiResponse;
import io.swagger.v3.oas.annotations.responses.ApiResponses;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
@RestController
@RequestMapping("/datainitializer")
public class DataInitializerController {
private final DataInitializer dataInitializer;
@Autowired
public DataInitializerController(DataInitializer dataInitializer) {
this.dataInitializer = dataInitializer;
}
@Operation(summary = "Seed certificate database", description = "Seeds certificate database. Drops all data first.")
@ApiResponses(value = {
@ApiResponse(responseCode = "204", description = "Data initialized successfully."),
})
@PostMapping
public ResponseEntity<Void> initialize() {
dataInitializer.initialize();
return ResponseEntity.noContent().build();
}
@Operation(summary = "Drop certificate database", description = "Drops all data from certificate database")
@ApiResponses(value = {
@ApiResponse(responseCode = "204", description = "Data dropped successfully."),
})
@DeleteMapping
public ResponseEntity<Void> drop() {
dataInitializer.drop();
return ResponseEntity.noContent().build();
}
}
drop table if exists certificate cascade
\ No newline at end of file
INSERT INTO certificate (id_certificate, certificate_file, certificate_file_name, id_course, generated_at, id_user) VALUES (1, 'certificate_file_1.pdf', 'Certificate for Course English A1', 2, '2023-04-29 10:30:00', 7);
INSERT INTO certificate (id_certificate, certificate_file, certificate_file_name, id_course, generated_at, id_user) VALUES (2, 'certificate_file_2.pdf', 'Certificate for Course English A2', 3, '2023-04-28 14:15:00', 7);
INSERT INTO certificate (id_certificate, certificate_file, certificate_file_name, id_course, generated_at, id_user) VALUES (3, 'certificate_file_2.pdf', 'Certificate for Course English A2', 3, '2023-04-28 14:15:00', 9);
INSERT INTO certificate (id_certificate, certificate_file, certificate_file_name, id_course, generated_at, id_user) VALUES (4, 'certificate_file_2.pdf', 'Certificate for Course English B1', 4, '2023-04-28 14:15:00', 7);
INSERT INTO certificate (id_certificate, certificate_file, certificate_file_name, id_course, generated_at, id_user) VALUES (5, 'certificate_file_2.pdf', 'Certificate for Course English B1', 4, '2023-04-28 14:15:00', 9);
ALTER TABLE certificate ALTER COLUMN id_certificate RESTART WITH 6;
\ No newline at end of file
package org.fuseri.moduleexercise.datainitializer;
import org.fuseri.moduleexercise.answer.Answer;
import org.fuseri.moduleexercise.answer.AnswerRepository;
import org.fuseri.moduleexercise.exercise.Exercise;
import org.fuseri.moduleexercise.exercise.ExerciseRepository;
import org.fuseri.moduleexercise.question.Question;
import org.fuseri.moduleexercise.question.QuestionRepository;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import java.util.HashSet;
import java.util.List;
@Component
public class DataInitializer {
private final ExerciseRepository exerciseRepository;
private final QuestionRepository questionRepository;
private final AnswerRepository answerRepository;
@Autowired
public DataInitializer(ExerciseRepository exerciseRepository, QuestionRepository questionRepository,
AnswerRepository answerRepository) {
this.exerciseRepository = exerciseRepository;
this.questionRepository = questionRepository;
this.answerRepository = answerRepository;
}
public void drop() {
exerciseRepository.deleteAll();
}
public void initialize() {
drop();
// exercise
var ex1 = new Exercise("Present Continuous Exercise 1", "Practice using the present continuous tense.", 6, 5, new HashSet<>());
var ex2 = new Exercise("Past Simple Exercise 1", "Use the past simple to describe past events.", 6, 5, new HashSet<>());
var ex3 = new Exercise("Food Vocabulary Exercise 1", "Learn vocabulary related to food.", 2, 5, new HashSet<>());
var ex4 = new Exercise("Job Interview Exercise 1", "Practice answering common job interview questions.", 7, 5, new HashSet<>());
var ex5 = new Exercise("Begrüßung und Vorstellung Übung", "Übung zum Begrüßen und Vorstellen", 2, 1, new HashSet<>());
exerciseRepository.saveAll(List.of(ex1, ex2, ex3, ex4, ex5));
// question
var q1 = new Question("What is the correct form of the present continuous tense of \"run\"?", new HashSet<>(), ex1);
var q2 = new Question("Which verbs are not usually used in the present continuous tense?", new HashSet<>(), ex1);
var q3 = new Question("What did you do last weekend?", new HashSet<>(), ex2);
var q4 = new Question("What did you eat for breakfast this morning?", new HashSet<>(), ex2);
var q5 = new Question("Where did you go on vacation last year?", new HashSet<>(), ex2);
var q6 = new Question("What is the English word for \"la comida\"?", new HashSet<>(), ex3);
var q7 = new Question("Tell me about yourself.", new HashSet<>(), ex4);
var q8 = new Question("Why are you interested in this job?", new HashSet<>(), ex4);
var q9 = new Question("What are your greatest strengths and weaknesses?", new HashSet<>(), ex4);
var q10 = new Question("Can you give an example of a time when you overcame a challenge?", new HashSet<>(), ex4);
var q11 = new Question("Where do you see yourself in five years?", new HashSet<>(), ex4);
var q12 = new Question("Was ist eine höfliche Begrüßung im Deutschen?", new HashSet<>(), ex5);
var q13 = new Question("Wie antwortet man auf die Frage \"Wie geht es Ihnen?\"", new HashSet<>(), ex5);
var q14 = new Question("Wie stellt man sich auf Deutsch vor?", new HashSet<>(), ex5);
var questions = List.of(q1, q2, q3, q4, q5, q6, q7, q8, q9, q10, q11, q12, q13, q14);
questionRepository.saveAll(questions);
// answer
var a1 = new Answer("is running", true, q1);
var a2 = new Answer("are running", false, q1);
var a3 = new Answer("am running", false, q1);
var a4 = new Answer("think", true, q2);
var a5 = new Answer("want", true, q2);
var a6 = new Answer("love", false, q2);
var a7 = new Answer("I visited my family.", true, q3);
var a8 = new Answer("I'm visiting my family.", false, q3);
var a9 = new Answer("I will visit my family.", false, q3);
var a10 = new Answer("the food", true, q4);
var a11 = new Answer("the drink", false, q4);
var a12 = new Answer("the music", false, q4);
var a13 = new Answer("I ate cereal for breakfast.", true, q5);
var a14 = new Answer("I eat cereal for breakfast.", false, q5);
var a15 = new Answer("I will eat cereal for breakfast.", false, q5);
var a16 = new Answer("I went to Hawaii on vacation last year.", true, q6);
var a17 = new Answer("I'm going to Hawaii on vacation next year.", false, q6);
var a18 = new Answer("I will go to Hawaii on vacation next year.", false, q6);
var a19 = new Answer("I was born in a small town in the midwest.", false, q7);
var a20 = new Answer("I graduated from XYZ University with a degree in computer science.", false, q7);
var a21 = new Answer("I have over five years of experience in software development.", true, q7);
var a22 = new Answer("I just need a job.", false, q8);
var a23 = new Answer("I am excited about the company culture and the opportunities for growth.", true, q8);
var a24 = new Answer("I heard the salary is good.", false, q8);
var a25 = new Answer("My greatest strength is my attention to detail. My greatest weakness is public speaking.", true, q9);
var a26 = new Answer("My greatest strength is my ability to multitask. My greatest weakness is that I am a perfectionist.", false, q9);
var a27 = new Answer("My greatest strength is my leadership skills. My greatest weakness is that I work too hard.", false, q9);
var a28 = new Answer("When I was working on a project for a client, the client requested changes that were outside the scope of the project. I had to work with the client to manage their expectations and negotiate a compromise.", true, q10);
var a29 = new Answer("When I was in college, I had a difficult time balancing my coursework and my social life. I had to learn how to manage my time better.", false, q10);
var a30 = new Answer("I have never faced a significant challenge in my professional life.", false, q10);
var a31 = new Answer("I see myself in a management position, leading a team of developers.", false, q11);
var a32 = new Answer("I see myself as a valuable contributor to the company, continuing to develop my skills and taking on new challenges.", true, q11);
var a33 = new Answer("Guten Tag!", true, q12);
var a34 = new Answer("Hallo!", false, q12);
var a35 = new Answer("Moin!", false, q12);
var a36 = new Answer("Mir geht es gut, danke!", true, q13);
var a37 = new Answer("Mir geht es schlecht, danke!", false, q13);
var a38 = new Answer("Mir geht es so lala.", false, q13);
var a39 = new Answer("Ich heiße [Name].", true, q14);
var a40 = new Answer("Ich bin [Name].", false, q14);
var a41 = new Answer("Ich komme aus [Land].", false, q14);
var answers = List.of(
a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15,
a16, a17, a18, a19, a20, a21, a22, a23, a24, a25, a26, a27, a28,
a29, a30, a31, a32, a33, a34, a35, a36, a37, a38, a39, a40, a41);
answerRepository.saveAll(answers);
}
}
package org.fuseri.moduleexercise.datainitializer;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.responses.ApiResponse;
import io.swagger.v3.oas.annotations.responses.ApiResponses;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
@RestController
@RequestMapping("/datainitializer")
public class DataInitializerController {
private final DataInitializer dataInitializer;
@Autowired
public DataInitializerController(DataInitializer dataInitializer) {
this.dataInitializer = dataInitializer;
}
@Operation(summary = "Seed exercise database", description = "Seeds exercise database. Drops all data first")
@ApiResponses(value = {
@ApiResponse(responseCode = "204", description = "Data initialized successfully."),
})
@PostMapping
public ResponseEntity<Void> initialize() {
dataInitializer.initialize();
return ResponseEntity.noContent().build();
}
@Operation(summary = "Drop exercise database", description = "Drops all data from exercise database")
@ApiResponses(value = {
@ApiResponse(responseCode = "204", description = "Data dropped successfully."),
})
@DeleteMapping
public ResponseEntity<Void> drop() {
dataInitializer.drop();
return ResponseEntity.noContent().build();
}
}
drop table if exists answer cascade
drop table if exists exercise cascade
drop table if exists question cascade
\ No newline at end of file
-- exercise
-- insert into exercise (id, lecture_id, description, difficulty, name) values (default, ?, ?, ?, ?)
INSERT INTO exercise (id, course_id, description, difficulty, name) VALUES (1, 5, 'Practice using the present continuous tense.', 3, 'Present Continuous Exercise 1');
INSERT INTO exercise (id, course_id, description, difficulty, name) VALUES (2, 5, 'Use the past simple to describe past events.', 6, 'Past Simple Exercise 1');
INSERT INTO exercise (id, course_id, description, difficulty, name) VALUES (3, 5, 'Learn vocabulary related to food.', 2, 'Food Vocabulary Exercise 1');
INSERT INTO exercise (id, course_id, description, difficulty, name) VALUES (4, 5, 'Practice answering common job interview questions.', 7, 'Job Interview Exercise 1');
INSERT INTO exercise (id, course_id, description, difficulty, name) VALUES (5, 1, 'Übung zum Begrüßen und Vorstellen', 2, 'Begrüßung und Vorstellung Übung');
ALTER TABLE exercise ALTER COLUMN id RESTART WITH 6;
-- question
-- insert into question (id, exercise_id, text) values (default, ?, ?)
INSERT INTO question (id, exercise_id, text) VALUES (1, 1, 'What is the correct form of the present continuous tense of "run"?');
INSERT INTO question (id, exercise_id, text) VALUES (2, 1, 'Which verbs are not usually used in the present continuous tense?');
INSERT INTO question (id, exercise_id, text) VALUES (3, 2, 'What did you do last weekend?');
INSERT INTO question (id, exercise_id, text) VALUES (4, 2, 'What did you eat for breakfast this morning?');
INSERT INTO question (id, exercise_id, text) VALUES (5, 2, 'Where did you go on vacation last year?');
INSERT INTO question (id, exercise_id, text) VALUES (6, 3, 'What is the English word for "la comida"?');
INSERT INTO question (id, exercise_id, text) VALUES (7, 4, 'Tell me about yourself.');
INSERT INTO question (id, exercise_id, text) VALUES (8, 4, 'Why are you interested in this job?');
INSERT INTO question (id, exercise_id, text) VALUES (9, 4, 'What are your greatest strengths and weaknesses?');
INSERT INTO question (id, exercise_id, text) VALUES (10, 4, 'Can you give an example of a time when you overcame a challenge?');
INSERT INTO question (id, exercise_id, text) VALUES (11, 4, 'Where do you see yourself in five years?');
INSERT INTO question (id, exercise_id, text) VALUES (12, 5, 'Was ist eine höfliche Begrüßung im Deutschen?');
INSERT INTO question (id, exercise_id, text) VALUES (13, 5, 'Wie antwortet man auf die Frage "Wie geht es Ihnen?"');
INSERT INTO question (id, exercise_id, text) VALUES (14, 5, 'Wie stellt man sich auf Deutsch vor?');
ALTER TABLE question ALTER COLUMN id RESTART WITH 15;
-- answer
-- INSERT INTO answer (is_correct, question_id, text) VALUES (1, 1, 'is running')
INSERT INTO answer (id, question_id, is_correct, text) VALUES (1, 1, true, 'is running');
INSERT INTO answer (id, question_id, is_correct, text) VALUES (2, 1, false, 'are running');
INSERT INTO answer (id, question_id, is_correct, text) VALUES (3, 1, false, 'am running');
INSERT INTO answer (id, question_id, is_correct, text) VALUES (4, 2, true, 'think');
INSERT INTO answer (id, question_id, is_correct, text) VALUES (5, 2, true, 'want');
INSERT INTO answer (id, question_id, is_correct, text) VALUES (6, 2, false, 'love');
INSERT INTO answer (id, question_id, is_correct, text) VALUES (7, 3, true, 'I visited my family.');
INSERT INTO answer (id, question_id, is_correct, text) VALUES (8, 3, false, 'I''m visiting my family.');
INSERT INTO answer (id, question_id, is_correct, text) VALUES (9, 3, false, 'I will visit my family.');
INSERT INTO answer (id, question_id, is_correct, text) VALUES (10, 4, true, 'the food');
INSERT INTO answer (id, question_id, is_correct, text) VALUES (11, 4, false, 'the drink');
INSERT INTO answer (id, question_id, is_correct, text) VALUES (12, 4, false, 'the music');
INSERT INTO answer (id, question_id, is_correct, text) VALUES (13, 5, true, 'I ate cereal for breakfast.');
INSERT INTO answer (id, question_id, is_correct, text) VALUES (14, 5, false, 'I eat cereal for breakfast.');
INSERT INTO answer (id, question_id, is_correct, text) VALUES (15, 5, false, 'I will eat cereal for breakfast.');
INSERT INTO answer (id, question_id, is_correct, text) VALUES (16, 6, true, 'I went to Hawaii on vacation last year.');
INSERT INTO answer (id, question_id, is_correct, text) VALUES (17, 6, false, 'I''m going to Hawaii on vacation next year.');
INSERT INTO answer (id, question_id, is_correct, text) VALUES (18, 6, false, 'I will go to Hawaii on vacation next year.');
INSERT INTO answer (id, question_id, is_correct, text) VALUES (19, 7, false, 'I was born in a small town in the midwest.');
INSERT INTO answer (id, question_id, is_correct, text) VALUES (20, 7, false, 'I graduated from XYZ University with a degree in computer science.');
INSERT INTO answer (id, question_id, is_correct, text) VALUES (21, 7, true, 'I have over five years of experience in software development.');
INSERT INTO answer (id, question_id, is_correct, text) VALUES (22, 8, false, 'I just need a job.');
INSERT INTO answer (id, question_id, is_correct, text) VALUES (23, 8, true, 'I am excited about the company culture and the opportunities for growth.');
INSERT INTO answer (id, question_id, is_correct, text) VALUES (24, 8, false, 'I heard the salary is good.');
INSERT INTO answer (id, question_id, is_correct, text) VALUES (25, 9, true, 'My greatest strength is my attention to detail. My greatest weakness is public speaking.');
INSERT INTO answer (id, question_id, is_correct, text) VALUES (26, 9, false, 'My greatest strength is my ability to multitask. My greatest weakness is that I am a perfectionist.');
INSERT INTO answer (id, question_id, is_correct, text) VALUES (27, 9, false, 'My greatest strength is my leadership skills. My greatest weakness is that I work too hard.');
INSERT INTO answer (id, question_id, is_correct, text) VALUES (28, 10, true, 'When I was working on a project for a client, the client requested changes that were outside the scope of the project. I had to work with the client to manage their expectations and negotiate a compromise.');
INSERT INTO answer (id, question_id, is_correct, text) VALUES (29, 10, false, 'When I was in college, I had a difficult time balancing my coursework and my social life. I had to learn how to manage my time better.');
INSERT INTO answer (id, question_id, is_correct, text) VALUES (30, 10, false, 'I have never faced a significant challenge in my professional life.');
INSERT INTO answer (id, question_id, is_correct, text) VALUES (31, 11, false, 'I see myself in a management position, leading a team of developers.');
INSERT INTO answer (id, question_id, is_correct, text) VALUES (32, 11, true, 'I see myself as a valuable contributor to the company, continuing to develop my skills and taking on new challenges.');
INSERT INTO answer (id, question_id, is_correct, text) VALUES (33, 12, true, 'Guten Tag!');
INSERT INTO answer (id, question_id, is_correct, text) VALUES (34, 12, false, 'Hallo!');
INSERT INTO answer (id, question_id, is_correct, text) VALUES (35, 12, false, 'Moin!');
INSERT INTO answer (id, question_id, is_correct, text) VALUES (36, 13, true, 'Mir geht es gut, danke!');
INSERT INTO answer (id, question_id, is_correct, text) VALUES (37, 13, false, 'Mir geht es schlecht, danke!');
INSERT INTO answer (id, question_id, is_correct, text) VALUES (38, 13, false, 'Mir geht es so lala.');
INSERT INTO answer (id, question_id, is_correct, text) VALUES (39, 14, true, 'Ich heiße [Name].');
INSERT INTO answer (id, question_id, is_correct, text) VALUES (40, 14, false, 'Ich bin [Name].');
INSERT INTO answer (id, question_id, is_correct, text) VALUES (41, 14, false, 'Ich komme aus [Land].');
ALTER TABLE answer ALTER COLUMN id RESTART WITH 42;
\ No newline at end of file
......@@ -5,8 +5,8 @@ import lombok.*;
import org.fuseri.modulelanguageschool.common.DomainObject;
import org.fuseri.modulelanguageschool.user.User;
import java.util.ArrayList;
import java.util.List;
import java.util.Set;
@Getter
@Setter
......@@ -45,6 +45,14 @@ public class Course extends DomainObject {
this.proficiency = proficiency;
}
public Course(String name, Integer capacity, Language language, ProficiencyLevel proficiency, List<User> students) {
this.name = name;
this.capacity = capacity;
this.language = language;
this.proficiency = proficiency;
this.students = students;
}
public void setFinished(boolean finished) {
this.finished = finished;
}
......
package org.fuseri.modulelanguageschool.datainitializer;
import org.fuseri.modulelanguageschool.course.Course;
import org.fuseri.modulelanguageschool.course.CourseRepository;
import org.fuseri.modulelanguageschool.course.Language;
import org.fuseri.modulelanguageschool.course.ProficiencyLevel;
import org.fuseri.modulelanguageschool.lecture.Lecture;
import org.fuseri.modulelanguageschool.lecture.LectureRepository;
import org.fuseri.modulelanguageschool.user.Address;
import org.fuseri.modulelanguageschool.user.User;
import org.fuseri.modulelanguageschool.user.UserRepository;
import org.fuseri.modulelanguageschool.user.UserType;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import java.time.LocalDateTime;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;
@Component
public class DataInitializer {
private final CourseRepository courseRepository;
private final LectureRepository lectureRepository;
private final UserRepository userRepository;
Course c1;
Course c2;
Course c3;
Course c4;
Course c5;
Course c6;
private Lecture germanLectureIntro;
private User germanLecturer;
private User englishLecturer;
private Lecture englishLectureIntro;
private Lecture englishLectureTense;
@Autowired
public DataInitializer(CourseRepository courseRepository, LectureRepository lectureRepository,
UserRepository userRepository) {
this.courseRepository = courseRepository;
this.lectureRepository = lectureRepository;
this.userRepository = userRepository;
}
public void drop() {
userRepository.deleteAll();
courseRepository.deleteAll();
}
public void initialize() {
drop();
initializeCourseAndLecture();
initializeUser();
}
private void initializeCourseAndLecture() {
c1 = new Course("German for Beginners", 25, Language.GERMAN, ProficiencyLevel.A1, new ArrayList<>());
c2 = new Course("English A1", 25, Language.ENGLISH, ProficiencyLevel.A1, new ArrayList<>());
c3 = new Course("English A2", 25, Language.ENGLISH, ProficiencyLevel.A2, new ArrayList<>());
c4 = new Course("English B1", 25, Language.ENGLISH, ProficiencyLevel.B1, new ArrayList<>());
c5 = new Course("English B2", 25, Language.ENGLISH, ProficiencyLevel.B2, new ArrayList<>());
c6 = new Course("Spanish B1", 25, Language.SPANISH, ProficiencyLevel.B1, new ArrayList<>());
courseRepository.saveAll(List.of(c1, c2, c3, c4, c5, c6));
germanLectureIntro = new Lecture(LocalDateTime.of(2023, 5, 2, 10, 0), LocalDateTime.of(2023, 5, 2, 12, 0),
"Introduction to course", 25, c1, germanLecturer);
var l2 = new Lecture(LocalDateTime.of(2023, 5, 4, 10, 0), LocalDateTime.of(2023, 5, 4, 12, 0),
"Begrüßung und Vorstellung", 25, c1, germanLecturer);
var l3 = new Lecture(LocalDateTime.of(2023, 5, 9, 10, 0), LocalDateTime.of(2023, 5, 9, 12, 0),
"Mein Wohnort und meine Wohnung", 25, c1, germanLecturer);
var l4 = new Lecture(LocalDateTime.of(2023, 5, 11, 10, 0), LocalDateTime.of(2023, 5, 11, 12, 0),
"Essen und Trinken", 25, c1, germanLecturer);
var l5 = new Lecture(LocalDateTime.of(2023, 5, 16, 10, 0), LocalDateTime.of(2023, 5, 16, 12, 0),
"Meine Familie und Freunde", 25, c1, germanLecturer);
englishLectureIntro = new Lecture(LocalDateTime.of(2023, 5, 1, 10, 0), LocalDateTime.of(2023, 5, 1, 12, 0),
"Introduction to course", 25, c5, englishLecturer);
englishLectureTense = new Lecture(LocalDateTime.of(2023, 5, 6, 10, 0), LocalDateTime.of(2023, 5, 6, 12, 0),
"Repetition of english tenses", 25, c5, englishLecturer);
var l8 = new Lecture(LocalDateTime.of(2023, 5, 8, 10, 0), LocalDateTime.of(2023, 5, 8, 12, 0),
"Food", 25, c5, englishLecturer);
var l9 = new Lecture(LocalDateTime.of(2023, 5, 8, 10, 0), LocalDateTime.of(2023, 5, 8, 12, 0),
"School systems around the world", 25, c5, englishLecturer);
var l10 = new Lecture(LocalDateTime.of(2023, 5, 15, 10, 0), LocalDateTime.of(2023, 5, 15, 12, 0),
"Interview questions", 25, c5, englishLecturer);
lectureRepository.saveAll(List.of(germanLectureIntro, l2, l3, l4, l5, englishLectureIntro, englishLectureTense, l8, l9, l10));
}
private void initializeUser() {
// admin
var a1 = new User("johndoe", UserType.ADMIN, "password123", "john.doe@example.com", "John", "Doe",
new Address("USA", "New York", "Main Street", "123", "10001"));
var a2 = new User("janesmith", UserType.ADMIN, "password123", "jane.smith@example.com", "Jane", "Smith",
new Address("USA", "Los Angeles", "Broadway", "456", "90012"));
// lecturer
englishLecturer = new User("anaken", UserType.LECTURER, "password123", "ana.kentinsky@example.com", "Ana", "Kentinsky",
new Address("USA", "Los Angeles", "Hollywood Blvd", "456", "90028"));
var l4 = new User("michaeljones", UserType.LECTURER, "password123", "michael.jones@example.com", "Michael", "Jones",
new Address("UK", "London", "Baker St", "789", "NW1 6XE"));
var l5 = new User("clairedupont", UserType.LECTURER, "password123", "claire.dupont@example.com", "Claire", "Dupont",
new Address("France", "Paris", "Champs-Élysées", "456", "75008"));
germanLecturer = new User("maxmustermann", UserType.LECTURER, "password123", "max.mustermann@example.com", "Max", "Mustermann",
new Address("Germany", "Berlin", "Friedrichstrasse", "123", "10117"));
// students
User s7 = new User("samuelsmith", UserType.STUDENT, "password123", "samuel.smith@example.com", "Samuel", "Smith",
new Address("New York", "USA", "Fifth Ave", "100", "10019"));
User s8 = new User("jessicanguyen", UserType.STUDENT, "password123", "jessica.nguyen@example.com", "Jessica", "Nguyen",
new Address("Los Angeles", "USA", "Sunset Blvd", "789", "90046"));
User s9 = new User("peterhansen", UserType.STUDENT, "password123", "peter.hansen@example.com", "Peter", "Hansen",
new Address("London", "UK", "Oxford St", "234", "W1C 1JG"));
User s10 = new User("luciedupont", UserType.STUDENT, "password123", "lucie.dupont@example.com", "Lucie", "Dupont",
new Address("Paris", "France", "Rue de Rivoli", "15", "75001"));
User s11 = new User("hansschmidt", UserType.STUDENT, "password123", "hans.schmidt@example.com", "Hans", "Schmidt",
new Address("Berlin", "Germany", "Unter den Linden", "45", "10117"));
User s12 = new User("emmajones", UserType.STUDENT, "password123", "emma.jones@example.com", "Emma", "Jones",
new Address("New York", "USA", "Broadway", "456", "10003"));
User s13 = new User("oliversmith", UserType.STUDENT, "password123", "oliver.smith@example.com", "Oliver", "Smith",
new Address("London", "UK", "Baker Street", "22", "W1U 3BW"));
User s14 = new User("lauragarcia", UserType.STUDENT, "password123", "laura.garcia@example.com", "Laura", "Garcia",
new Address("Madrid", "Spain", "Calle Mayor", "18", "28013"));
User s15 = new User("felixmueller", UserType.STUDENT, "password123", "felix.mueller@example.com", "Felix", "Mueller",
new Address("Berlin", "Germany", "Torstrasse", "32", "10119"));
User s16 = new User("emiliedupont", UserType.STUDENT, "password123", "emilie.dupont@example.com", "Emilie", "Dupont",
new Address("Paris", "France", "Rue de Rivoli", "5", "75001"));
User s17 = new User("peterkovac", UserType.STUDENT, "password123", "pkovac@example.com", "Peter", "Kovac",
new Address("Bratislava", "Slovakia", "Main Street", "123", "12345"));
User s18 = new User("davidprachar", UserType.STUDENT, "password123", "prachar@example.com", "David", "Prachar",
new Address("Brno", "Czechia", "Main Street", "123", "12345"));
// language_proficiency
englishLecturer.addLanguageProficiency(Language.ENGLISH, ProficiencyLevel.C2N);
l4.addLanguageProficiency(Language.ENGLISH, ProficiencyLevel.C1N);
l4.addLanguageProficiency(Language.SPANISH, ProficiencyLevel.C1);
l5.addLanguageProficiency(Language.GERMAN, ProficiencyLevel.C1);
germanLecturer.addLanguageProficiency(Language.GERMAN, ProficiencyLevel.C1N);
s7.addLanguageProficiency(Language.ENGLISH, ProficiencyLevel.B1);
s9.addLanguageProficiency(Language.ENGLISH, ProficiencyLevel.B1);
s11.addLanguageProficiency(Language.ENGLISH, ProficiencyLevel.B1);
s8.addLanguageProficiency(Language.GERMAN, ProficiencyLevel.B2);
s10.addLanguageProficiency(Language.GERMAN, ProficiencyLevel.A1);
s11.addLanguageProficiency(Language.GERMAN, ProficiencyLevel.A1);
s12.addLanguageProficiency(Language.GERMAN, ProficiencyLevel.A1);
s13.addLanguageProficiency(Language.GERMAN, ProficiencyLevel.A1);
s14.addLanguageProficiency(Language.GERMAN, ProficiencyLevel.A1);
s15.addLanguageProficiency(Language.CZECH, ProficiencyLevel.A1);
s16.addLanguageProficiency(Language.SPANISH, ProficiencyLevel.B1);
s17.addLanguageProficiency(Language.SPANISH, ProficiencyLevel.A2);
s18.addLanguageProficiency(Language.SPANISH, ProficiencyLevel.B1);
// course - user
courseEnrolStudents(c1, List.of(s10, s11, s12, s13, s14));
c2.enrolStudent(s7);
courseEnrolStudents(c3, List.of(s7, s9));
courseEnrolStudents(c4, List.of(s7, s9));
courseEnrolStudents(c5, List.of(s7, s9, s11));
// lecture - user
lectureEnrolStudents(germanLectureIntro, List.of(s10, s11, s12, s13, s14));
lectureEnrolStudents(englishLectureIntro, List.of(s7, s9));
lectureEnrolStudents(englishLectureIntro, List.of(s7, s9, s11));
userRepository.saveAll(List.of(a1, a2, englishLecturer, l4, l5, germanLecturer,
s7, s8, s9, s10, s11, s12, s13, s14, s15, s16, s17, s18));
courseRepository.save(c1);
lectureRepository.saveAll(List.of(germanLectureIntro, englishLectureIntro, englishLectureTense));
}
private void courseEnrolStudents(Course c, List<User> students) {
for (var s : students) {
c.enrolStudent(s);
}
}
private void lectureEnrolStudents(Lecture l, List<User> students) {
for (var s : students) {
l.enrolStudent(s);
}
}
}
package org.fuseri.modulelanguageschool.datainitializer;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.responses.ApiResponse;
import io.swagger.v3.oas.annotations.responses.ApiResponses;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
@RestController
@RequestMapping("/datainitializer")
public class DataInitializerController {
private final DataInitializer dataInitializer;
@Autowired
public DataInitializerController(DataInitializer dataInitializer) {
this.dataInitializer = dataInitializer;
}
@Operation(summary = "Seed language school database", description = "Seeds language school database. Drops all data first")
@ApiResponses(value = {
@ApiResponse(responseCode = "204", description = "Data initialized successfully."),
})
@PostMapping
public ResponseEntity<Void> initialize() {
dataInitializer.initialize();
return ResponseEntity.noContent().build();
}
@Operation(summary = "Drop language school database", description = "Drops all data from language school database")
@ApiResponses(value = {
@ApiResponse(responseCode = "204", description = "Data dropped successfully."),
})
@DeleteMapping
public ResponseEntity<Void> drop() {
dataInitializer.drop();
return ResponseEntity.noContent().build();
}
}
......@@ -10,6 +10,7 @@ import org.fuseri.modulelanguageschool.course.Course;
import org.fuseri.modulelanguageschool.user.User;
import java.time.LocalDateTime;
import java.util.ArrayList;
import java.util.List;
/**
......@@ -38,6 +39,17 @@ public class Lecture extends DomainObject {
@ManyToMany
private List<User> students;
public Lecture(LocalDateTime lectureFrom, LocalDateTime lectureTo,
String topic, Integer capacity, Course course, User lecturer) {
this.lectureFrom = lectureFrom;
this.lectureTo = lectureTo;
this.topic = topic;
this.capacity = capacity;
this.course = course;
this.lecturer = lecturer;
this.students = new ArrayList<>();
}
public void enrolStudent(User student) {
students.add(student);
}
......
......@@ -7,6 +7,8 @@ import org.fuseri.modulelanguageschool.course.Course;
import org.fuseri.modulelanguageschool.course.Language;
import org.fuseri.modulelanguageschool.course.ProficiencyLevel;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Map;
import java.util.Set;
......@@ -46,6 +48,19 @@ public class User extends DomainObject {
@ElementCollection
private Map<Language, ProficiencyLevel> languageProficiency;
public User(String username, UserType userType, String password,
String email, String firstName, String lastName, Address address) {
this.username = username;
this.userType = userType;
this.password = password;
this.email = email;
this.firstName = firstName;
this.lastName = lastName;
this.address = address;
this.courses = new HashSet<>();
this.languageProficiency = new HashMap<>();
}
public void addLanguageProficiency(Language language, ProficiencyLevel proficiencyLevel) {
languageProficiency.put(language, proficiencyLevel);
}
......
drop table if exists course cascade
drop table if exists course_students cascade
drop table if exists domain_user cascade
drop table if exists lecture cascade
drop table if exists lecture_students cascade
drop table if exists user_course cascade
drop table if exists user_language_proficiency cascade
\ No newline at end of file
-- I add ids manually, so I can better see what data are related
-- LANGUAGE
-- 0 - english
-- 1 - german
-- 2 - spanish
-- 3 - czech
-- PROFICIENCY
-- 0 - A1
-- 1 - A2
-- 2 - B1
-- 3 - B2
-- 4 - C1
-- 5 - C2
-- 6 - C1N
-- 7 - C2N
-- USER
-- admin
INSERT INTO domain_user (id, city, country, house_number, street, zip, email, first_name, last_name, password, user_type, username) VALUES (1, 'New York', 'USA', 123, 'Main Street', '10001', 'john.doe@example.com', 'John', 'Doe', 'password123', 'ADMIN', 'johndoe');
INSERT INTO domain_user (id, city, country, house_number, street, zip, email, first_name, last_name, password, user_type, username) VALUES (2, 'Los Angeles', 'USA', 456, 'Broadway', '90012', 'jane.smith@example.com', 'Jane', 'Smith', 'password123', 'ADMIN', 'janesmith');
-- lecturer
INSERT INTO domain_user (id, city, country, house_number, street, zip, email, first_name, last_name, password, user_type, username) VALUES (3, 'Los Angeles', 'USA', 456, 'Hollywood Blvd', '90028', 'jane.smith@example.com', 'Jane', 'Smith', 'password123', 'LECTURER', 'janesmith');
INSERT INTO domain_user (id, city, country, house_number, street, zip, email, first_name, last_name, password, user_type, username) VALUES (4, 'London', 'UK', 789, 'Baker St', 'NW1 6XE', 'michael.jones@example.com', 'Michael', 'Jones', 'password123', 'LECTURER', 'michaeljones');
INSERT INTO domain_user (id, city, country, house_number, street, zip, email, first_name, last_name, password, user_type, username) VALUES (5, 'Paris', 'France', 456, 'Champs-Élysées', '75008', 'claire.dupont@example.com', 'Claire', 'Dupont', 'password123', 'LECTURER', 'clairedupont');
INSERT INTO domain_user (id, city, country, house_number, street, zip, email, first_name, last_name, password, user_type, username) VALUES (6, 'Berlin', 'Germany', 123, 'Friedrichstrasse', '10117', 'max.mustermann@example.com', 'Max', 'Mustermann', 'password123', 'LECTURER', 'maxmustermann');
-- student
INSERT INTO domain_user (id, city, country, house_number, street, zip, email, first_name, last_name, password, user_type, username) VALUES (7, 'New York', 'USA', 100, 'Fifth Ave', '10019', 'samuel.smith@example.com', 'Samuel', 'Smith', 'password123', 'STUDENT', 'samuelsmith');
INSERT INTO domain_user (id, city, country, house_number, street, zip, email, first_name, last_name, password, user_type, username) VALUES (8, 'Los Angeles', 'USA', 789, 'Sunset Blvd', '90046', 'jessica.nguyen@example.com', 'Jessica', 'Nguyen', 'password123', 'STUDENT', 'jessicanguyen');
INSERT INTO domain_user (id, city, country, house_number, street, zip, email, first_name, last_name, password, user_type, username) VALUES (9, 'London', 'UK', 234, 'Oxford St', 'W1C 1JG', 'peter.hansen@example.com', 'Peter', 'Hansen', 'password123', 'STUDENT', 'peterhansen');
INSERT INTO domain_user (id, city, country, house_number, street, zip, email, first_name, last_name, password, user_type, username) VALUES (10, 'Paris', 'France', 15, 'Rue de Rivoli', '75001', 'lucie.dupont@example.com', 'Lucie', 'Dupont', 'password123', 'STUDENT', 'luciedupont');
INSERT INTO domain_user (id, city, country, house_number, street, zip, email, first_name, last_name, password, user_type, username) VALUES (11, 'Berlin', 'Germany', 45, 'Unter den Linden', '10117', 'hans.schmidt@example.com', 'Hans', 'Schmidt', 'password123', 'STUDENT', 'hansschmidt');
INSERT INTO domain_user (id, city, country, house_number, street, zip, email, first_name, last_name, password, user_type, username) VALUES (12, 'New York', 'USA', 456, 'Broadway', '10003', 'emma.jones@example.com', 'Emma', 'Jones', 'password123', 'STUDENT', 'emmajones');
INSERT INTO domain_user (id, city, country, house_number, street, zip, email, first_name, last_name, password, user_type, username) VALUES (13, 'London', 'UK', 22, 'Baker Street', 'W1U 3BW', 'oliver.smith@example.com', 'Oliver', 'Smith', 'password123', 'STUDENT', 'oliversmith');
INSERT INTO domain_user (id, city, country, house_number, street, zip, email, first_name, last_name, password, user_type, username) VALUES (14, 'Madrid', 'Spain', 18, 'Calle Mayor', '28013', 'laura.garcia@example.com', 'Laura', 'Garcia', 'password123', 'STUDENT', 'lauragarcia');
INSERT INTO domain_user (id, city, country, house_number, street, zip, email, first_name, last_name, password, user_type, username) VALUES (15, 'Berlin', 'Germany', 32, 'Torstrasse', '10119', 'felix.mueller@example.com', 'Felix', 'Mueller', 'password123', 'STUDENT', 'felixmueller');
INSERT INTO domain_user (id, city, country, house_number, street, zip, email, first_name, last_name, password, user_type, username) VALUES (16, 'Paris', 'France', 5, 'Rue de Rivoli', '75001', 'emilie.dupont@example.com', 'Emilie', 'Dupont', 'password123', 'STUDENT', 'emiliedupont');
INSERT INTO domain_user (id, city, country, house_number, street, zip, email, first_name, last_name, password, user_type, username) VALUES (17, 'Bratislava', 'Slovakia', 123, 'Main Street', '12345', 'pkovac@example.com', 'Peter', 'Kovac', 'password123', 'STUDENT', 'peterkovac');
INSERT INTO domain_user (id, city, country, house_number, street, zip, email, first_name, last_name, password, user_type, username) VALUES (18, 'Brno', 'Czechia', 123, 'Main Street', '12345', 'prachar@example.com', 'David', 'Prachar', 'password123', 'STUDENT', 'davidprachar');
ALTER TABLE domain_user ALTER COLUMN id RESTART WITH 19;
-- language_proficiency
INSERT INTO user_language_proficiency (user_id, language_proficiency_key, language_proficiency) VALUES (3, 0, 6);
INSERT INTO user_language_proficiency (user_id, language_proficiency_key, language_proficiency) VALUES (4, 0, 7);
INSERT INTO user_language_proficiency (user_id, language_proficiency_key, language_proficiency) VALUES (4, 2, 4);
INSERT INTO user_language_proficiency (user_id, language_proficiency_key, language_proficiency) VALUES (5, 2, 5);
INSERT INTO user_language_proficiency (user_id, language_proficiency_key, language_proficiency) VALUES (5, 3, 6);
INSERT INTO user_language_proficiency (user_id, language_proficiency_key, language_proficiency) VALUES (6, 1, 7);
INSERT INTO user_language_proficiency (user_id, language_proficiency_key, language_proficiency) VALUES (7, 0, 4);
INSERT INTO user_language_proficiency (user_id, language_proficiency_key, language_proficiency) VALUES (8, 1, 3);
INSERT INTO user_language_proficiency (user_id, language_proficiency_key, language_proficiency) VALUES (9, 0, 2);
INSERT INTO user_language_proficiency (user_id, language_proficiency_key, language_proficiency) VALUES (10, 3, 4);
INSERT INTO user_language_proficiency (user_id, language_proficiency_key, language_proficiency) VALUES (11, 3, 3);
INSERT INTO user_language_proficiency (user_id, language_proficiency_key, language_proficiency) VALUES (12, 2, 1);
INSERT INTO user_language_proficiency (user_id, language_proficiency_key, language_proficiency) VALUES (13, 2, 1);
INSERT INTO user_language_proficiency (user_id, language_proficiency_key, language_proficiency) VALUES (14, 2, 1);
INSERT INTO user_language_proficiency (user_id, language_proficiency_key, language_proficiency) VALUES (15, 1, 1);
INSERT INTO user_language_proficiency (user_id, language_proficiency_key, language_proficiency) VALUES (16, 1, 1);
INSERT INTO user_language_proficiency (user_id, language_proficiency_key, language_proficiency) VALUES (17, 1, 1);
INSERT INTO user_language_proficiency (user_id, language_proficiency_key, language_proficiency) VALUES (18, 1, 1);
-- COURSE
INSERT INTO course (id, capacity, finished, language, name, proficiency) VALUES (1, 25, false, 'GERMAN', 'German for Beginners', 'A1');
INSERT INTO course (id, capacity, finished, language, name, proficiency) VALUES (2, 25, false, 'ENGLISH', 'English A1', 'A1');
INSERT INTO course (id, capacity, finished, language, name, proficiency) VALUES (3, 25, false, 'ENGLISH', 'English A2', 'A2');
INSERT INTO course (id, capacity, finished, language, name, proficiency) VALUES (4, 25, false, 'ENGLISH', 'English B1', 'B1');
INSERT INTO course (id, capacity, finished, language, name, proficiency) VALUES (5, 25, false, 'ENGLISH', 'English B2', 'B2');
INSERT INTO course (id, capacity, finished, language, name, proficiency) VALUES (6, 25, false, 'SPANISH', 'Spanish B1', 'B1');
ALTER TABLE course ALTER COLUMN id RESTART WITH 4;
-- COURSE-USER
INSERT INTO user_course (student_id, course_id) VALUES (8, 1);
INSERT INTO user_course (student_id, course_id) VALUES (15, 1);
INSERT INTO user_course (student_id, course_id) VALUES (16, 1);
INSERT INTO user_course (student_id, course_id) VALUES (17, 1);
INSERT INTO user_course (student_id, course_id) VALUES (18, 1);
INSERT INTO user_course (student_id, course_id) VALUES (7, 2);
INSERT INTO user_course (student_id, course_id) VALUES (7, 3);
INSERT INTO user_course (student_id, course_id) VALUES (9, 3);
INSERT INTO user_course (student_id, course_id) VALUES (7, 4);
INSERT INTO user_course (student_id, course_id) VALUES (9, 4);
INSERT INTO user_course (student_id, course_id) VALUES (7, 5);
INSERT INTO user_course (student_id, course_id) VALUES (9, 5);
-- LECTURE
insert into lecture (id, capacity, course_id, lecture_from, lecture_to, lecturer_id, topic) values (1, 25, 1, '2023-05-02 10:00:00', '2023-05-02 12:00:00', 6, 'Introduction to course')
insert into lecture (id, capacity, course_id, lecture_from, lecture_to, lecturer_id, topic) values (2, 25, 1, '2023-05-04 10:00:00', '2023-05-04 12:00:00', 6, 'Begrüßung und Vorstellung')
insert into lecture (id, capacity, course_id, lecture_from, lecture_to, lecturer_id, topic) values (3, 25, 1, '2023-05-09 10:00:00', '2023-05-09 12:00:00', 6, 'Mein Wohnort und meine Wohnung')
insert into lecture (id, capacity, course_id, lecture_from, lecture_to, lecturer_id, topic) values (4, 25, 1, '2023-05-11 10:00:00', '2023-05-11 12:00:00', 6, 'Essen und Trinken')
insert into lecture (id, capacity, course_id, lecture_from, lecture_to, lecturer_id, topic) values (5, 25, 1, '2023-05-16 10:00:00', '2023-05-16 12:00:00', 6, 'Meine Familie und Freunde')
insert into lecture (id, capacity, course_id, lecture_from, lecture_to, lecturer_id, topic) values (6, 25, 5, '2023-05-01 10:00:00', '2023-05-01 12:00:00', 3, 'Introduction to course')
insert into lecture (id, capacity, course_id, lecture_from, lecture_to, lecturer_id, topic) values (7, 25, 5, '2023-05-06 10:00:00', '2023-05-06 12:00:00', 3, 'Repetition of english times')
insert into lecture (id, capacity, course_id, lecture_from, lecture_to, lecturer_id, topic) values (8, 25, 5, '2023-05-08 10:00:00', '2023-05-08 12:00:00', 3, 'Food')
insert into lecture (id, capacity, course_id, lecture_from, lecture_to, lecturer_id, topic) values (9, 25, 5, '2023-05-08 10:00:00', '2023-05-08 12:00:00', 3, 'School systems around the world')
insert into lecture (id, capacity, course_id, lecture_from, lecture_to, lecturer_id, topic) values (10, 25, 5, '2023-05-15 10:00:00', '2023-05-15 12:00:00', 3, 'Interview questions')
ALTER TABLE lecture ALTER COLUMN id RESTART WITH 10;
-- lecture-user
INSERT INTO lecture_students (students_id, lecture_id) VALUES (8, 1);
INSERT INTO lecture_students (students_id, lecture_id) VALUES (15, 1);
INSERT INTO lecture_students (students_id, lecture_id) VALUES (16, 1);
INSERT INTO lecture_students (students_id, lecture_id) VALUES (17, 1);
INSERT INTO lecture_students (students_id, lecture_id) VALUES (18, 1);
INSERT INTO lecture_students (students_id, lecture_id) VALUES (7, 6);
INSERT INTO lecture_students (students_id, lecture_id) VALUES (9, 6);
INSERT INTO lecture_students (students_id, lecture_id) VALUES (7, 7);
INSERT INTO lecture_students (students_id, lecture_id) VALUES (9, 7);
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment