Skip to content
Snippets Groups Projects
Commit 5f1be1ae authored by Oleg Semenov's avatar Oleg Semenov
Browse files

save fixed

parent 8a045afe
No related branches found
No related tags found
No related merge requests found
......@@ -19,7 +19,6 @@ export class CreateGroupComponent implements OnInit {
groups: GroupDO[];
selectedModule:ModulesDO;
selectedFaculty:FacultyDO;
selectedGroup: GroupDO;
newGroup: GroupDO;
errorMessage: string;
......@@ -39,10 +38,6 @@ export class CreateGroupComponent implements OnInit {
this.getAllGroups();
}
onSelectGroup(groups: GroupDO): void {
this.selectedGroup = groups;
}
clickToCreate(): void {
this.createGroup();
}
......@@ -74,16 +69,15 @@ export class CreateGroupComponent implements OnInit {
createGroup() {
let newID = this.modules.length + 1;
let moduleId = this.selectedModule.getId;
this.newGroup = new GroupDO(newID, moduleId, '', '');
this.newGroup = new GroupDO(newID, '', '', moduleId);
this.dataService.createGroupData(this.newGroup).then((group) => {
this.router.navigateByUrl('/new', {state: {group: this.newGroup}});
this.router.navigateByUrl('http://localhost:8080/groups/new', {state: {group: this.newGroup}});
}, (error) => {
if(error.type === ResponseType.CONNECTION_PROBLEM) {
this.errorMessage = 'Connection Problem';
} else {
this.errorMessage = 'Unknown error happened!';
}
}
);
});
}
}
export class GroupDO {
id: number;
modulid: number;
status: string;
date: string;
modulid: number;
constructor(private iD: number, private moduleId:
number, private statuS: string, datE: string) {
constructor(private iD: number, private statuS: string,
private datE: string, private moduleId: number) {
this.id = iD;
this.modulid = moduleId;
this.status = statuS;
......
......@@ -33,7 +33,7 @@ public class GroupManagementController {
@PostMapping("/groups/new")
public Learninggroup save(@RequestBody Learninggroup group){
groupRepository.save(group) {
groupRepository.save(group); {
group.setDatum(LocalDate.now());
group.setStatus("open");
}
......
......@@ -2,6 +2,7 @@ package thinkTogether.groupManagement.model;
import javax.persistence.*;
import java.sql.Date;
import java.time.LocalDate;
@Entity
public class Learninggroup {
......@@ -10,14 +11,14 @@ public class Learninggroup {
private String status;
private Date date;
private LocalDate date;
private int modulid;
protected Learninggroup() {
}
public Learninggroup(String status, Date erstelldatum, int modulid) {
public Learninggroup(String status, LocalDate erstelldatum, int modulid) {
this.date = erstelldatum;
this.modulid = modulid;
this.status = status;
......@@ -32,11 +33,11 @@ public class Learninggroup {
return id;
}
public Date getDatum() {
public LocalDate getDatum() {
return date;
}
public void setDatum(Date datum) {
public void setDatum(LocalDate datum) {
this.date = datum;
}
......
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