diff --git a/src/main/java/mk/ukim/finki/wp/commonmodel/attendance/ScheduledClassSession.java b/src/main/java/mk/ukim/finki/wp/commonmodel/attendance/ScheduledClassSession.java index 4a23c34bf0c4fda59d3ba7990d567ad4c8f7834d..e7171bf1d23ffc7fab88b2168825ffa97c237767 100644 --- a/src/main/java/mk/ukim/finki/wp/commonmodel/attendance/ScheduledClassSession.java +++ b/src/main/java/mk/ukim/finki/wp/commonmodel/attendance/ScheduledClassSession.java @@ -3,6 +3,7 @@ package mk.ukim.finki.wp.commonmodel.attendance; import jakarta.persistence.*; import lombok.*; import mk.ukim.finki.wp.commonmodel.base.Room; +import mk.ukim.finki.wp.commonmodel.base.Semester; import mk.ukim.finki.wp.commonmodel.teachingallocation.schedule.Course; import java.time.DayOfWeek; @@ -25,6 +26,9 @@ public class ScheduledClassSession { @ManyToOne private Room room; + @ManyToOne + private Semester semester; + @Enumerated(EnumType.STRING) private ClassType type; diff --git a/src/main/java/mk/ukim/finki/wp/commonmodel/internships/Internship.java b/src/main/java/mk/ukim/finki/wp/commonmodel/internships/Internship.java index 4faea9878dfd6109a2c7b7ed813ca31e14a0f32e..3f3dc60ee65f5be64beb8d85d3cc94740cbd95da 100644 --- a/src/main/java/mk/ukim/finki/wp/commonmodel/internships/Internship.java +++ b/src/main/java/mk/ukim/finki/wp/commonmodel/internships/Internship.java @@ -54,6 +54,8 @@ public class Internship { private ZonedDateTime companyTokenExpiration; + private String contactPersonEmail; + public Internship(Student student) { this.student = student; } diff --git a/src/main/java/mk/ukim/finki/wp/commonmodel/irregularities/Irregularity.java b/src/main/java/mk/ukim/finki/wp/commonmodel/irregularities/Irregularity.java new file mode 100644 index 0000000000000000000000000000000000000000..79556db1ec24cc007059d9e0e93ab6d0b3927c3e --- /dev/null +++ b/src/main/java/mk/ukim/finki/wp/commonmodel/irregularities/Irregularity.java @@ -0,0 +1,78 @@ +package mk.ukim.finki.wp.commonmodel.irregularities; + +import com.fasterxml.jackson.annotation.JsonBackReference; +import jakarta.annotation.Nullable; +import jakarta.persistence.*; +import lombok.*; +import mk.ukim.finki.wp.commonmodel.base.*; + + +import java.time.LocalDateTime; +import java.util.List; +import java.util.UUID; + +@Entity +@Data +@NoArgsConstructor +@AllArgsConstructor +@Builder +@EqualsAndHashCode +public class Irregularity { + @Id + @Column(length = 8) + private String id; + + private String title; + + private String description; + + private LocalDateTime date; + + private boolean locked; + + @ManyToOne + @JsonBackReference + @JoinColumn(name = "student_id") + private Student student; + + @ManyToOne + @JsonBackReference + private Professor professor; + + @ManyToOne + @JsonBackReference + private Room room; + + @ManyToOne + @JsonBackReference + private Subject subject; + + @ManyToOne + @JsonBackReference + private User administrativeStaff; + + private String generalIrregularity; + + @Enumerated(EnumType.STRING) + private IrregularityType type; + + @Enumerated(EnumType.STRING) + private IrregularityStatus status; + + @ManyToOne + private User user; + + @OneToMany(mappedBy = "irregularity", cascade = CascadeType.ALL) + private List<IrregularityComment> staffComment; + + private String markedBy; + private LocalDateTime markedOn; + + @PrePersist + public void prePersist() { + this.id = UUID.randomUUID().toString().replace("-", "").substring(0, 6).toUpperCase(); + this.locked = false; + this.date = LocalDateTime.now(); + } + +} diff --git a/src/main/java/mk/ukim/finki/wp/commonmodel/irregularities/IrregularityComment.java b/src/main/java/mk/ukim/finki/wp/commonmodel/irregularities/IrregularityComment.java new file mode 100644 index 0000000000000000000000000000000000000000..0ec064063077fdc6e46b11898f01a79cd40d48ec --- /dev/null +++ b/src/main/java/mk/ukim/finki/wp/commonmodel/irregularities/IrregularityComment.java @@ -0,0 +1,37 @@ +package mk.ukim.finki.wp.commonmodel.irregularities; + +import jakarta.persistence.*; +import lombok.Data; +import lombok.NoArgsConstructor; +import mk.ukim.finki.wp.commonmodel.base.User; +import mk.ukim.finki.wp.commonmodel.lostfound.Item; +import org.hibernate.annotations.OnDelete; +import org.hibernate.annotations.OnDeleteAction; + +import java.util.Date; + +@Entity +@NoArgsConstructor +@Data +public class IrregularityComment { + @Id + @GeneratedValue(strategy = GenerationType.IDENTITY) + private Long id; + + private String comment; + + private Date dateAnswered; + + @ManyToOne + private User staffUser; + + @ManyToOne + @JoinColumn(name = "irregularity_id") + @OnDelete(action = OnDeleteAction.CASCADE) + private Irregularity irregularity; + + @Override + public String toString() { + return comment; + } +} diff --git a/src/main/java/mk/ukim/finki/wp/commonmodel/irregularities/IrregularityStatus.java b/src/main/java/mk/ukim/finki/wp/commonmodel/irregularities/IrregularityStatus.java new file mode 100644 index 0000000000000000000000000000000000000000..95279a7e12ce95e1a58718a256bef74fd6ac9b97 --- /dev/null +++ b/src/main/java/mk/ukim/finki/wp/commonmodel/irregularities/IrregularityStatus.java @@ -0,0 +1,16 @@ +package mk.ukim.finki.wp.commonmodel.irregularities; + +import lombok.Getter; + +@Getter +public enum IrregularityStatus { + UNREAD("РќРµ прочитано"), + READ ("Прочитано"), + DONE("Разрешено"); + + private final String macedonianName; + + IrregularityStatus(String macedonianName) { + this.macedonianName = macedonianName; + } +} diff --git a/src/main/java/mk/ukim/finki/wp/commonmodel/irregularities/IrregularityType.java b/src/main/java/mk/ukim/finki/wp/commonmodel/irregularities/IrregularityType.java new file mode 100644 index 0000000000000000000000000000000000000000..15d86619ff115f8a48759483258035dd9b39ba50 --- /dev/null +++ b/src/main/java/mk/ukim/finki/wp/commonmodel/irregularities/IrregularityType.java @@ -0,0 +1,20 @@ +package mk.ukim.finki.wp.commonmodel.irregularities; + +import lombok.Getter; + +@Getter +public enum IrregularityType { + SUBJECT("Предмет"), + PROFESSOR("Професор"), + STUDENT("Студент"), + ROOM("РЎРѕР±Р°"), + GENERAL("Генерално"), + ADMINISTRATION("АдминистрациСР°"); + + private final String macedonianName; + + IrregularityType(String macedonianName) { + this.macedonianName = macedonianName; + } + +} \ No newline at end of file diff --git a/src/main/java/mk/ukim/finki/wp/commonmodel/lostfound/Item.java b/src/main/java/mk/ukim/finki/wp/commonmodel/lostfound/Item.java new file mode 100644 index 0000000000000000000000000000000000000000..d3cb45e54fcdac482aa398153e35bf3d384d4315 --- /dev/null +++ b/src/main/java/mk/ukim/finki/wp/commonmodel/lostfound/Item.java @@ -0,0 +1,67 @@ +package mk.ukim.finki.wp.commonmodel.lostfound; + +import jakarta.persistence.*; +import lombok.Getter; +import lombok.NoArgsConstructor; +import lombok.Setter; +import mk.ukim.finki.wp.commonmodel.base.User; + +import java.time.LocalDate; +import java.util.ArrayList; +import java.util.Base64; +import java.util.List; + +@Entity +@NoArgsConstructor +@Getter +@Setter +public class Item { + + @Id + @GeneratedValue(strategy = GenerationType.IDENTITY) + private Long id; + + private String name; + + @Enumerated(EnumType.STRING) + private ItemCategory itemCategory; + + private String description; + + private LocalDate dateIssueCreated; + + private String location; + + @Enumerated(EnumType.STRING) + private ItemType itemType; + + private byte[] image; + + private boolean handover; + + @ManyToOne + private User user; + + @OneToMany(mappedBy = "item", cascade = CascadeType.REMOVE, orphanRemoval = true) + private List<ItemComment> comments = new ArrayList<>(); + + private String phoneNumber; + + public Item(String name, ItemCategory itemCategory, String description, LocalDate dateIssueCreated, String location, ItemType itemType, byte[] image, User user, String phoneNumber) { + + this.name = name; + this.itemCategory = itemCategory; + this.description = description; + this.dateIssueCreated = dateIssueCreated; + this.location = location; + this.itemType = itemType; + this.image = image; + this.handover = false; + this.user = user; + this.phoneNumber = phoneNumber; + } + public String getBase64Image() { + return this.image != null ? Base64.getEncoder().encodeToString(this.image) : null; + } + +} \ No newline at end of file diff --git a/src/main/java/mk/ukim/finki/wp/commonmodel/lostfound/ItemCategory.java b/src/main/java/mk/ukim/finki/wp/commonmodel/lostfound/ItemCategory.java new file mode 100644 index 0000000000000000000000000000000000000000..f7f98bbb2ccd742f4fbd01280b4790602c32a4b2 --- /dev/null +++ b/src/main/java/mk/ukim/finki/wp/commonmodel/lostfound/ItemCategory.java @@ -0,0 +1,33 @@ +package mk.ukim.finki.wp.commonmodel.lostfound; + +import lombok.Getter; + +@Getter +public enum ItemCategory { + MOBILE_PHONES("Мобилни телефони"), + LAPTOPS("Лаптопи"), + TABLETS("Таблети"), + CAMERAS("Фотоапарати"), + HEADPHONES("Слушалки"), + SMARTWATCHES("Смарт часовници"), + CHARGERS("Полначи"), + USB_DRIVES("USB уреди"), + KEYS("Клучеви"), + WALLETS("Паричници"), + GLASSES("Очила"), + WATCHES("Рачни часовници"), + JEWELRY("Накит"), + ACCESSORIES("Додатоци"), + CLOTHING("Облека"), + BAGS("РўРѕСЂР±Рё"), + DOCUMENTS("Документи"), + BOOK("РљРЅРёРіРё"), + OTHER("Друго"); + + private final String categoryName; + + ItemCategory(String categoryName) { + this.categoryName = categoryName; + } + +} diff --git a/src/main/java/mk/ukim/finki/wp/commonmodel/lostfound/ItemComment.java b/src/main/java/mk/ukim/finki/wp/commonmodel/lostfound/ItemComment.java new file mode 100644 index 0000000000000000000000000000000000000000..bd92116b53f5891ef6973c73674d1160331aaf79 --- /dev/null +++ b/src/main/java/mk/ukim/finki/wp/commonmodel/lostfound/ItemComment.java @@ -0,0 +1,75 @@ +package mk.ukim.finki.wp.commonmodel.lostfound; + +import jakarta.persistence.*; +import lombok.AllArgsConstructor; +import lombok.Getter; +import lombok.NoArgsConstructor; +import lombok.Setter; +import mk.ukim.finki.wp.commonmodel.base.User; +import org.hibernate.annotations.OnDelete; +import org.hibernate.annotations.OnDeleteAction; + +import java.time.Duration; +import java.time.LocalDateTime; +import java.util.ArrayList; +import java.util.Base64; +import java.util.List; + +@Entity +@NoArgsConstructor +@AllArgsConstructor +@Getter +@Setter +public class ItemComment { + @Id + @GeneratedValue(strategy = GenerationType.IDENTITY) + private Long id; + private String content; + + @ManyToOne + private User author; + + @ManyToOne + @JoinColumn(name = "item_id") + @OnDelete(action = OnDeleteAction.CASCADE) + private Item item; + + @ManyToOne + @JoinColumn(name = "parent_comment_id") + private ItemComment parentComment; + + private LocalDateTime dateTime; + + @OneToMany(mappedBy = "parentComment", cascade = CascadeType.REMOVE) + private List<ItemComment> replies = new ArrayList<>(); + + private byte[] image; + + public static String formatTimeAgo(LocalDateTime timestamp) { + LocalDateTime now = LocalDateTime.now(); + Duration duration = Duration.between(timestamp, now); + + if (duration.toMinutes() < 1) { + return "Just now"; + } else if (duration.toMinutes() < 60) { + long minutes = duration.toMinutes(); + return minutes + (minutes == 1 ? " minute ago" : " minutes ago"); + } else if (duration.toHours() < 24) { + long hours = duration.toHours(); + return hours + (hours == 1 ? " hour ago" : " hours ago"); + } else if (duration.toDays() < 7) { + long days = duration.toDays(); + return days + (days == 1 ? " day ago" : " days ago"); + } else { + long weeks = duration.toDays() / 7; + return weeks + (weeks == 1 ? " week ago" : " weeks ago"); + } + } + + public String getBase64Image() { + if (this.image == null) { + return null; + } + return Base64.getEncoder().encodeToString(this.image); } +} + diff --git a/src/main/java/mk/ukim/finki/wp/commonmodel/lostfound/ItemType.java b/src/main/java/mk/ukim/finki/wp/commonmodel/lostfound/ItemType.java new file mode 100644 index 0000000000000000000000000000000000000000..ca3ca9b00be77e2c075f7a40a4646814fc07129e --- /dev/null +++ b/src/main/java/mk/ukim/finki/wp/commonmodel/lostfound/ItemType.java @@ -0,0 +1,16 @@ +package mk.ukim.finki.wp.commonmodel.lostfound; + +import lombok.Getter; + +@Getter +public enum ItemType { + LOST("Рзгубено"), + FOUND("РќР°Сдено"); + + private final String typeName; + + ItemType(String typeName) { + this.typeName = typeName; + } + +} diff --git a/src/main/java/mk/ukim/finki/wp/commonmodel/nns/CommissionMember.java b/src/main/java/mk/ukim/finki/wp/commonmodel/nns/CommissionMember.java new file mode 100644 index 0000000000000000000000000000000000000000..43ecc310fff362ad432632831f00f2cd185eaf92 --- /dev/null +++ b/src/main/java/mk/ukim/finki/wp/commonmodel/nns/CommissionMember.java @@ -0,0 +1,40 @@ +package mk.ukim.finki.wp.commonmodel.nns; + +import com.fasterxml.jackson.annotation.JsonBackReference; +import com.fasterxml.jackson.annotation.JsonManagedReference; +import jakarta.persistence.*; +import lombok.*; +import mk.ukim.finki.wp.commonmodel.base.Professor; + +import java.util.List; + +@Getter +@Setter +@ToString +@NoArgsConstructor +@AllArgsConstructor +@Entity +public class CommissionMember +{ + @Id + @GeneratedValue(strategy = GenerationType.IDENTITY) + @Column(name = "id") + private Long id; + + @ManyToOne + @JsonBackReference + private Professor professor; + + @Enumerated(EnumType.STRING) + private CommissionMemberType type; + + @ManyToMany(mappedBy = "commissionMembers") + @JsonManagedReference + private List<Topic> topics; + + public CommissionMember(Professor professor, CommissionMemberType type) + { + this.professor = professor; + this.type = type; + } +} diff --git a/src/main/java/mk/ukim/finki/wp/commonmodel/nns/CommissionMemberType.java b/src/main/java/mk/ukim/finki/wp/commonmodel/nns/CommissionMemberType.java new file mode 100644 index 0000000000000000000000000000000000000000..91652cfc2f121468268857f25e0f1bd3c49d2cc0 --- /dev/null +++ b/src/main/java/mk/ukim/finki/wp/commonmodel/nns/CommissionMemberType.java @@ -0,0 +1,21 @@ +package mk.ukim.finki.wp.commonmodel.nns; + +public enum CommissionMemberType +{ + PRESIDENT, MEMBER, MENTOR; + + public String typeName() + { + switch(this.name()) + { + case "PRESIDENT": + return "Претседател"; + case "MEMBER": + return "Член"; + case "MENTOR": + return "Ментор"; + } + + return this.name(); + } +} diff --git a/src/main/java/mk/ukim/finki/wp/commonmodel/nns/TeachingAndScientificMeeting.java b/src/main/java/mk/ukim/finki/wp/commonmodel/nns/TeachingAndScientificMeeting.java index 3b45a3a516586188a4fd739967fe8dd41b5e043f..61e82a46bd42e6e892c07b41eeba800beb24067c 100644 --- a/src/main/java/mk/ukim/finki/wp/commonmodel/nns/TeachingAndScientificMeeting.java +++ b/src/main/java/mk/ukim/finki/wp/commonmodel/nns/TeachingAndScientificMeeting.java @@ -1,10 +1,14 @@ package mk.ukim.finki.wp.commonmodel.nns; -import jakarta.persistence.Entity; -import jakarta.persistence.Id; +import com.fasterxml.jackson.annotation.JsonManagedReference; +import jakarta.persistence.*; import lombok.*; +import mk.ukim.finki.wp.commonmodel.base.Room; +import mk.ukim.finki.wp.commonmodel.base.User; import java.time.LocalDate; +import java.time.LocalDateTime; +import java.util.List; @Getter @Setter @@ -17,9 +21,19 @@ public class TeachingAndScientificMeeting { @Id private String meetingNumber; - private LocalDate date; + private LocalDateTime date; private Integer presentMembers; + private Integer eligibleMembers; + @ManyToOne + private Room room; + + @ManyToOne + private User chairMan; + + @OneToMany(mappedBy = "meeting", cascade = CascadeType.ALL) + @JsonManagedReference + private List<Topic> topicsList; } diff --git a/src/main/java/mk/ukim/finki/wp/commonmodel/nns/Topic.java b/src/main/java/mk/ukim/finki/wp/commonmodel/nns/Topic.java index a93657de5565994fd4d097b0c5079c75017e04dd..0b59eeb1940c0f90b39ad59f217f2651dfabe4fc 100644 --- a/src/main/java/mk/ukim/finki/wp/commonmodel/nns/Topic.java +++ b/src/main/java/mk/ukim/finki/wp/commonmodel/nns/Topic.java @@ -1,5 +1,7 @@ package mk.ukim.finki.wp.commonmodel.nns; +import com.fasterxml.jackson.annotation.JsonBackReference; +import com.fasterxml.jackson.annotation.JsonManagedReference; import jakarta.persistence.*; import lombok.*; import mk.ukim.finki.wp.commonmodel.base.Professor; @@ -22,9 +24,12 @@ public class Topic { private String serialNumber; @Enumerated(EnumType.STRING) - private TopicCategory categoryName; + private TopicCategory category; - private String subCategoryName; // type + @Enumerated(EnumType.STRING) + private TopicStatus status; + + private String subCategoryName; @Column(length = 6000) private String description; @@ -36,20 +41,39 @@ public class Topic { private Integer sustainedNumber; private String discussion; + @Column(name = "file_url") + private String fileURL; + + @OneToMany(mappedBy = "topic", cascade = CascadeType.ALL, orphanRemoval = true) + @JsonManagedReference + private List<TopicComment> comments; + + @ManyToOne + @JsonBackReference + private Professor requestedByProfessor; @ManyToOne + @JsonBackReference + @JoinColumn(name="meeting_id") private TeachingAndScientificMeeting meeting; @ManyToOne + @JsonBackReference + @JoinColumn(name="mentioned_student_id") private Student mentionedStudent; @ManyToOne - private Professor professor; + @JsonBackReference + private Professor mentionedProfessor; @ManyToMany @ToString.Exclude - private List<Professor> mentionedProfessors; + @JsonBackReference + private List<CommissionMember> commissionMembers; + @OneToOne(cascade = CascadeType.ALL, orphanRemoval = true) + private TopicFile file; + private Boolean isVotable; } diff --git a/src/main/java/mk/ukim/finki/wp/commonmodel/nns/TopicComment.java b/src/main/java/mk/ukim/finki/wp/commonmodel/nns/TopicComment.java new file mode 100644 index 0000000000000000000000000000000000000000..01893662d15e7449a8aac13f509222cdde9144a7 --- /dev/null +++ b/src/main/java/mk/ukim/finki/wp/commonmodel/nns/TopicComment.java @@ -0,0 +1,44 @@ +package mk.ukim.finki.wp.commonmodel.nns; + +import com.fasterxml.jackson.annotation.JsonBackReference; +import jakarta.persistence.*; +import lombok.Getter; +import lombok.NoArgsConstructor; +import lombok.Setter; +import lombok.ToString; +import mk.ukim.finki.wp.commonmodel.base.Professor; + +import java.time.LocalDateTime; + +@Entity +@Getter +@Setter +@ToString +@NoArgsConstructor +public class TopicComment +{ + @Id + @GeneratedValue(strategy = GenerationType.IDENTITY) + private Long id; + + @Column(length = 4000) + private String commentText; + + @ManyToOne + @JsonBackReference + private Topic topic; + + private LocalDateTime datePosted; + + @ManyToOne + @JsonBackReference + private Professor professor; + + public TopicComment(String commentText, Topic topic, LocalDateTime datePosted, Professor professor) + { + this.commentText = commentText; + this.topic = topic; + this.datePosted = datePosted; + this.professor = professor; + } +} diff --git a/src/main/java/mk/ukim/finki/wp/commonmodel/nns/TopicFile.java b/src/main/java/mk/ukim/finki/wp/commonmodel/nns/TopicFile.java new file mode 100644 index 0000000000000000000000000000000000000000..b0b791187a7f651d6e8a383bcf342fe0cf8152c5 --- /dev/null +++ b/src/main/java/mk/ukim/finki/wp/commonmodel/nns/TopicFile.java @@ -0,0 +1,26 @@ +package mk.ukim.finki.wp.commonmodel.nns; + + +import jakarta.persistence.*; +import lombok.*; + +@Getter +@Setter +@ToString +@NoArgsConstructor +@AllArgsConstructor +@Entity +public class TopicFile { + @Id + @GeneratedValue(strategy = GenerationType.IDENTITY) + private Long id; + + private String fileName; + + private byte[] content; + + public TopicFile(String fileName, byte[] content) { + this.fileName = fileName; + this.content = content; + } +} diff --git a/src/main/java/mk/ukim/finki/wp/commonmodel/nns/TopicStatus.java b/src/main/java/mk/ukim/finki/wp/commonmodel/nns/TopicStatus.java new file mode 100644 index 0000000000000000000000000000000000000000..9727277533f45d26982e1714d4fd9c2c489a2598 --- /dev/null +++ b/src/main/java/mk/ukim/finki/wp/commonmodel/nns/TopicStatus.java @@ -0,0 +1,29 @@ +package mk.ukim.finki.wp.commonmodel.nns; + +public enum TopicStatus +{ + REQUESTED, SCHEDULED, UNDER_DISCUSSION, FINISHED, CANCELED; + + public String statusName() + { + switch(this.name()) + { + case "REQUESTED": + return "Предлог"; + case "SCHEDULED": + return "Закажан"; + case "UNDER_DISCUSSION": + return "Моментална точка"; + case "FINISHED": + return "Завршен"; + case "CANCELED": + return "Откажан"; + } + return this.name(); + } + + @Override + public String toString() { + return name(); + } +} diff --git a/src/main/java/mk/ukim/finki/wp/commonmodel/results/Results.java b/src/main/java/mk/ukim/finki/wp/commonmodel/results/Results.java index f284ebb0fabe7c29abc7e2ff37e6f7038d01cff5..4256d1b1a2cf1659db1453547a3aaffdaaafc997 100644 --- a/src/main/java/mk/ukim/finki/wp/commonmodel/results/Results.java +++ b/src/main/java/mk/ukim/finki/wp/commonmodel/results/Results.java @@ -3,8 +3,9 @@ package mk.ukim.finki.wp.commonmodel.results; import jakarta.persistence.*; import lombok.*; +import mk.ukim.finki.wp.commonmodel.base.Professor; import mk.ukim.finki.wp.commonmodel.examschedule.YearExamSession; -import mk.ukim.finki.wp.commonmodel.teachingallocation.schedule.Course; +import mk.ukim.finki.wp.commonmodel.teachingallocation.JoinedSubject; import org.hibernate.Hibernate; import java.time.LocalDateTime; @@ -28,10 +29,17 @@ public class Results { private YearExamSession session; @ManyToOne - private Course course; + private JoinedSubject joinedSubject; private byte[] pdfBytes; + private String resultType; + + @ManyToOne + private Professor uploadedBy; + + private String note; + private LocalDateTime uploadedAt; @Override diff --git a/src/main/resources/db/migration/V1_100__results_model_update.sql b/src/main/resources/db/migration/V1_100__results_model_update.sql new file mode 100644 index 0000000000000000000000000000000000000000..841592e11c523ce19a20f42e65360e613620e561 --- /dev/null +++ b/src/main/resources/db/migration/V1_100__results_model_update.sql @@ -0,0 +1,4 @@ +alter table results + add column if not exists result_type varchar(255), + add column if not exists uploaded_by_id varchar(255) + constraint fk_results_on_uploaded_by_id references professor (id); \ No newline at end of file diff --git a/src/main/resources/db/migration/V1_101__lost_found_model_update.sql b/src/main/resources/db/migration/V1_101__lost_found_model_update.sql new file mode 100644 index 0000000000000000000000000000000000000000..657bbd393ff5852d7f53cf47fa6cc49c12ea85c8 --- /dev/null +++ b/src/main/resources/db/migration/V1_101__lost_found_model_update.sql @@ -0,0 +1,42 @@ +create table if not exists item +( + id bigint generated by default as identity not null + primary key, + name varchar(255), + item_category varchar(255), + description TEXT, + date_issue_created DATE, + location varchar(255), + item_type varchar(255), + image bytea, + handover boolean default false, + user_id varchar(255), + phone_number varchar(50), + + CONSTRAINT fk_item_user FOREIGN KEY (user_id) + REFERENCES auth_user(id) +); + +create table if not exists comment +( + id bigint generated by default as identity not null + primary key, + content TEXT, + author_id varchar(255), + item_id BIGINT, + parent_comment_id BIGINT, + date_time TIMESTAMP, + image bytea, + + CONSTRAINT fk_comment_author FOREIGN KEY (author_id) + REFERENCES auth_user(id) + ON DELETE SET NULL, + + CONSTRAINT fk_comment_item FOREIGN KEY (item_id) + REFERENCES item(id) + ON DELETE CASCADE, + + CONSTRAINT fk_comment_parent FOREIGN KEY (parent_comment_id) + REFERENCES comment(id) + ON DELETE CASCADE +); \ No newline at end of file diff --git a/src/main/resources/db/migration/V1_102__item_comment_rename.sql b/src/main/resources/db/migration/V1_102__item_comment_rename.sql new file mode 100644 index 0000000000000000000000000000000000000000..13f1da295cb19cc94064f30d30ef5bccf19f0ab8 --- /dev/null +++ b/src/main/resources/db/migration/V1_102__item_comment_rename.sql @@ -0,0 +1,22 @@ +ALTER TABLE comment + RENAME TO item_comment; + +ALTER TABLE item_comment +DROP CONSTRAINT fk_comment_item, + ADD CONSTRAINT fk_item_comment_item FOREIGN KEY (item_id) + REFERENCES item(id) + ON DELETE CASCADE; + +ALTER TABLE item_comment +DROP CONSTRAINT fk_comment_author, + ADD CONSTRAINT fk_item_comment_author FOREIGN KEY (author_id) + REFERENCES auth_user(id) + ON DELETE SET NULL; + +ALTER TABLE item_comment +DROP CONSTRAINT fk_comment_parent, + ADD CONSTRAINT fk_item_comment_parent FOREIGN KEY (parent_comment_id) + REFERENCES item_comment(id) + ON DELETE CASCADE; + +ALTER INDEX comment_pkey RENAME TO item_comment_pkey; \ No newline at end of file diff --git a/src/main/resources/db/migration/V1_103__irregularities_table_creation.sql b/src/main/resources/db/migration/V1_103__irregularities_table_creation.sql new file mode 100644 index 0000000000000000000000000000000000000000..2f82dc14b23f56c8df550b9b414954ff7d13e314 --- /dev/null +++ b/src/main/resources/db/migration/V1_103__irregularities_table_creation.sql @@ -0,0 +1,36 @@ +create table irregularity +( + id VARCHAR(8) PRIMARY KEY, + title VARCHAR(255), + description TEXT, + date TIMESTAMP NOT NULL, + locked BOOLEAN NOT NULL, + student_id VARCHAR(255), + professor_id VARCHAR(255), + room_name VARCHAR(255), + subject_id VARCHAR(255), + administrative_staff_id VARCHAR(255), + general_irregularity VARCHAR(255), + type VARCHAR(255) NOT NULL, + status VARCHAR(255) NOT NULL, + user_id VARCHAR(255), + marked_by VARCHAR(255), + marked_on TIMESTAMP, + FOREIGN KEY (student_id) REFERENCES student (student_index), + FOREIGN KEY (professor_id) REFERENCES professor (id), + FOREIGN KEY (room_name) REFERENCES room (name), + FOREIGN KEY (subject_id) REFERENCES subject (id), + FOREIGN KEY (administrative_staff_id) REFERENCES auth_user (id), + FOREIGN KEY (user_id) REFERENCES auth_user (id) +); + +create table irregularity_comment +( + id bigint generated by default as identity not null, + comment TEXT, + date_answered TIMESTAMP, + staff_user_id VARCHAR(255), + irregularity_id VARCHAR(8) not null, + FOREIGN KEY (staff_user_id) REFERENCES auth_user (id), + FOREIGN KEY (irregularity_id) REFERENCES irregularity (id) ON DELETE CASCADE +); diff --git a/src/main/resources/db/migration/V1_104__nns.sql b/src/main/resources/db/migration/V1_104__nns.sql new file mode 100644 index 0000000000000000000000000000000000000000..ba49c01483597b2de816ae6b35e223f0973ee68b --- /dev/null +++ b/src/main/resources/db/migration/V1_104__nns.sql @@ -0,0 +1,94 @@ +DROP TABLE IF EXISTS topic_commission_member cascade; +DROP TABLE IF EXISTS topic_file cascade; +DROP TABLE IF EXISTS comment cascade; +DROP TABLE IF EXISTS topic_comment cascade; +DROP TABLE IF EXISTS commission_member cascade; +DROP TABLE IF EXISTS topic_commission_members cascade; +DROP TABLE IF EXISTS topic cascade; +drop table if exists teaching_and_scientific_meeting cascade; + +CREATE TABLE commission_member +( + id bigint generated by default as identity not null primary key, + professor_id varchar(255), + type VARCHAR(255) +); + +CREATE TABLE topic_file +( + id bigint generated by default as identity not null primary key, + file_name VARCHAR(255), + content bytea +); + +CREATE TABLE topic +( + id bigint GENERATED BY DEFAULT AS IDENTITY NOT NULL PRIMARY KEY, + serial_number VARCHAR(255), + category VARCHAR(255), + status VARCHAR(255), + sub_category_name VARCHAR(255), + description VARCHAR(6000), + is_accepted BOOLEAN, + accept_number INTEGER, + against_number INTEGER, + sustained_number INTEGER, + discussion VARCHAR(255), + file_url VARCHAR(255), + is_votable BOOLEAN DEFAULT TRUE, + requested_by_professor_id varchar(255), + meeting_id varchar(255), + mentioned_student_id VARCHAR(255), + mentioned_professor_id VARCHAR(255), + file_id BIGINT +); + +CREATE TABLE topic_comment +( + id bigint generated by default as identity not null primary key, + comment_text VARCHAR(4000), + topic_id BIGINT, + date_posted TIMESTAMP, + professor_id varchar(255) +); + +CREATE TABLE topic_commission_members +( + topics_id BIGINT, + commission_members_id BIGINT, + PRIMARY KEY (topics_id, commission_members_id) +); + +CREATE TABLE teaching_and_scientific_meeting +( + meeting_number varchar(255) PRIMARY KEY, + date date, + present_members INTEGER, + eligible_members INTEGER, + room_name varchar(255), + chair_man_id varchar(255) +); + +ALTER TABLE commission_member + ADD FOREIGN KEY (professor_id) REFERENCES professor (id); + +ALTER TABLE topic_comment + ADD FOREIGN KEY (topic_id) REFERENCES topic (id), + ADD FOREIGN KEY (professor_id) REFERENCES professor (id); + +ALTER TABLE topic + ADD FOREIGN KEY (requested_by_professor_id) REFERENCES professor (id), + ADD FOREIGN KEY (meeting_id) REFERENCES teaching_and_scientific_meeting (meeting_number), + ADD FOREIGN KEY (mentioned_student_id) REFERENCES student (student_index), + ADD FOREIGN KEY (mentioned_professor_id) REFERENCES professor (id), + ADD FOREIGN KEY (file_id) REFERENCES topic_file (id); + +ALTER TABLE topic_commission_members + ADD FOREIGN KEY (topics_id) REFERENCES topic (id), + ADD FOREIGN KEY (commission_members_id) REFERENCES commission_member (id); + +ALTER TABLE teaching_and_scientific_meeting + ADD CONSTRAINT fk_room FOREIGN KEY (room_name) REFERENCES room(name); + +ALTER TABLE teaching_and_scientific_meeting + ADD CONSTRAINT fk_chairMan FOREIGN KEY (chair_man_id) REFERENCES auth_user(id); \ No newline at end of file diff --git a/src/main/resources/db/migration/V1_105__nns_type_change.sql b/src/main/resources/db/migration/V1_105__nns_type_change.sql new file mode 100644 index 0000000000000000000000000000000000000000..d15b226477984d8bca90ebcb6ad7ce0ce5297080 --- /dev/null +++ b/src/main/resources/db/migration/V1_105__nns_type_change.sql @@ -0,0 +1,2 @@ +ALTER TABLE teaching_and_scientific_meeting +ALTER COLUMN date TYPE TIMESTAMP; \ No newline at end of file diff --git a/src/main/resources/db/migration/V1_106__internship_add_column.sql b/src/main/resources/db/migration/V1_106__internship_add_column.sql new file mode 100644 index 0000000000000000000000000000000000000000..e40bdb76ca9ee7e474ea78545bcfee3fefee8497 --- /dev/null +++ b/src/main/resources/db/migration/V1_106__internship_add_column.sql @@ -0,0 +1,2 @@ +ALTER TABLE internship +add column if not exists contact_person_email varchar(255); \ No newline at end of file diff --git a/src/main/resources/db/migration/V1_98__results_model_update.sql b/src/main/resources/db/migration/V1_98__results_model_update.sql new file mode 100644 index 0000000000000000000000000000000000000000..d6b421bba90e3dc60200fa05c557eef78067938d --- /dev/null +++ b/src/main/resources/db/migration/V1_98__results_model_update.sql @@ -0,0 +1,19 @@ +alter table results + add column if not exists joined_subject_abbreviation varchar(255), + add column if not exists note varchar(1000); + + + +DO +$$ + BEGIN + alter table results + drop constraint fk_results_on_course_id; + + alter table results + drop column if exists course_id; + + EXCEPTION + WHEN undefined_column THEN raise notice 'date not exist'; + END; +$$; \ No newline at end of file diff --git a/src/main/resources/db/migration/V1_99__scheduled_class_session_semester.sql b/src/main/resources/db/migration/V1_99__scheduled_class_session_semester.sql new file mode 100644 index 0000000000000000000000000000000000000000..abb4701fa9cdc8ccdd51048b30b5ea8b5c20d4cd --- /dev/null +++ b/src/main/resources/db/migration/V1_99__scheduled_class_session_semester.sql @@ -0,0 +1,3 @@ +alter table scheduled_class_session + add column if not exists semester_code varchar(255) + constraint fk_scheduled_class_session_on_semester_code references semester (code); \ No newline at end of file diff --git a/src/main/resources/registry/services.csv b/src/main/resources/registry/services.csv index 70b7f385f3d5583df8bd535c938fd2b007db8794..a8e45df0f7099678ddebb76e663a84be6d9409d7 100644 --- a/src/main/resources/registry/services.csv +++ b/src/main/resources/registry/services.csv @@ -12,7 +12,9 @@ results-management 9010 0 https://gitlab.finki.ukim.mk/wp/results-management 1 exam-schedule 9011 0 https://gitlab.finki.ukim.mk/wp/exam-schedule 1 deklaracii 9012 0 https://gitlab.finki.ukim.mk/wp/deklaracii 0 memorandumi 9013 1 https://gitlab.finki.ukim.mk/wp/memorandumi 1 -praksi 9014 0 https://gitlab.finki.ukim.mk/wp/internships 0 -eu-project-wp-manager 9015 0 https://gitlab.finki.ukim.mk/wp/eu-project-wp-manager 1 -eu-project-frontend 9016 0 https://gitlab.finki.ukim.mk/wp/eu-project-frontend 1 -internships 9018 0 https://gitlab.finki.ukim.mk/wp/internships 0 \ No newline at end of file +eu-project-wp-manager 9015 0 https://gitlab.finki.ukim.mk/wp/eu-project-wp-manager 1 +eu-project-frontend 9016 0 https://gitlab.finki.ukim.mk/wp/eu-project-frontend 1 +internships 9018 1 https://gitlab.finki.ukim.mk/wp/internships 1 +lost-found 9019 0 https://gitlab.finki.ukim.mk/wp/lost-found-2 1 +neregularnosti 9020 0 https://gitlab.finki.ukim.mk/wp/neregularnosti 1 +nns 9021 0 https://gitlab.finki.ukim.mk/wp/nns 1 \ No newline at end of file