... | @@ -32,20 +32,176 @@ Para o desenvolvimento do projeto, a tecnologia de banco de dados escolhida foi |
... | @@ -32,20 +32,176 @@ Para o desenvolvimento do projeto, a tecnologia de banco de dados escolhida foi |
|
<img src="https://tools.ages.pucrs.br/comunicacao-hsl/comunicacao-hsl-wiki/raw/master/Images/db_diagrams/ModeloLogicoRelacional.png">
|
|
<img src="https://tools.ages.pucrs.br/comunicacao-hsl/comunicacao-hsl-wiki/raw/master/Images/db_diagrams/ModeloLogicoRelacional.png">
|
|
|
|
|
|
|
|
|
|
TBD
|
|
|
|
|
|
|
|
## Implementação
|
|
## Implementação
|
|
|
|
|
|
TBD
|
|
|
|
|
|
|
|
### Knex
|
|
|
|
|
|
|
|
TBD
|
|
|
|
|
|
|
|
### Schemas
|
|
### Schemas
|
|
|
|
|
|
TBD
|
|
**Announcements**
|
|
|
|
|
|
#### Postgrees
|
|
```java
|
|
|
|
@Entity
|
|
TBD |
|
@Table(name = "announcements")
|
|
|
|
@Data
|
|
|
|
@JsonIgnoreProperties({"hibernateLazyInitializer", "handler"})
|
|
|
|
@Proxy(lazy = false)
|
|
|
|
public class Announcement {
|
|
|
|
@Id
|
|
|
|
@Column(nullable = false)
|
|
|
|
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
|
|
|
private Long id;
|
|
|
|
|
|
|
|
@ManyToOne(fetch = FetchType.EAGER)
|
|
|
|
@JoinColumn(name = "idDepartment", referencedColumnName="id")
|
|
|
|
private Department department;
|
|
|
|
|
|
|
|
@Column(nullable = false)
|
|
|
|
private String title;
|
|
|
|
|
|
|
|
@Column(nullable = false)
|
|
|
|
private String content;
|
|
|
|
|
|
|
|
@OneToMany(cascade = CascadeType.ALL, fetch = FetchType.EAGER)
|
|
|
|
@JoinColumn(name = "idAttachment")
|
|
|
|
private List<Attachment> attachments;
|
|
|
|
|
|
|
|
@Column(nullable = false)
|
|
|
|
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm", iso = DateTimeFormat.ISO.DATE_TIME)
|
|
|
|
@JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd HH:mm")
|
|
|
|
private LocalDateTime date;
|
|
|
|
|
|
|
|
@Transient
|
|
|
|
private boolean viewed;
|
|
|
|
}
|
|
|
|
```
|
|
|
|
|
|
|
|
**Attachments**
|
|
|
|
|
|
|
|
```java
|
|
|
|
@Entity
|
|
|
|
@Table(name = "attachments")
|
|
|
|
@Data
|
|
|
|
@JsonIgnoreProperties({"hibernateLazyInitializer", "handler"})
|
|
|
|
@Proxy(lazy = false)
|
|
|
|
public class Attachment {
|
|
|
|
@Id
|
|
|
|
@Column
|
|
|
|
@GeneratedValue(strategy = GenerationType.AUTO)
|
|
|
|
private Long id;
|
|
|
|
|
|
|
|
@Column
|
|
|
|
private String fileName;
|
|
|
|
|
|
|
|
@Transient
|
|
|
|
private String contentAsBase64;
|
|
|
|
}
|
|
|
|
```
|
|
|
|
|
|
|
|
**Departments**
|
|
|
|
|
|
|
|
```java
|
|
|
|
@Entity
|
|
|
|
@Table(name = "departments")
|
|
|
|
@Data
|
|
|
|
@JsonIgnoreProperties({"hibernateLazyInitializer", "handler"})
|
|
|
|
@Proxy(lazy = false)
|
|
|
|
public class Department {
|
|
|
|
|
|
|
|
@Id
|
|
|
|
@Column(nullable = false)
|
|
|
|
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
|
|
|
private Long id;
|
|
|
|
|
|
|
|
@Column(nullable = false)
|
|
|
|
private String name;
|
|
|
|
|
|
|
|
@Column(nullable = false)
|
|
|
|
private String branchLine;
|
|
|
|
|
|
|
|
@Column(nullable = false)
|
|
|
|
private String email;
|
|
|
|
|
|
|
|
}
|
|
|
|
```
|
|
|
|
|
|
|
|
**Users**
|
|
|
|
|
|
|
|
```java
|
|
|
|
@Entity
|
|
|
|
@Table(name = "users")
|
|
|
|
@Data
|
|
|
|
@Builder
|
|
|
|
@NoArgsConstructor
|
|
|
|
@AllArgsConstructor
|
|
|
|
@JsonIgnoreProperties({"hibernateLazyInitializer", "handler"})
|
|
|
|
@Proxy(lazy = false)
|
|
|
|
public class User {
|
|
|
|
@Id
|
|
|
|
@Column(nullable = false)
|
|
|
|
private Long registry;
|
|
|
|
|
|
|
|
@Column(nullable = false)
|
|
|
|
private String name;
|
|
|
|
|
|
|
|
@Column(nullable = false)
|
|
|
|
private boolean isAdmin;
|
|
|
|
|
|
|
|
@Column(nullable = false)
|
|
|
|
private int day;
|
|
|
|
|
|
|
|
@Column(nullable = false)
|
|
|
|
private int month;
|
|
|
|
|
|
|
|
@ManyToOne(fetch = FetchType.EAGER)
|
|
|
|
@JoinColumn(name = "idDepartment", referencedColumnName = "id")
|
|
|
|
private Department department;
|
|
|
|
|
|
|
|
@Column
|
|
|
|
private boolean active;
|
|
|
|
|
|
|
|
@Column
|
|
|
|
private String email;
|
|
|
|
|
|
|
|
@Column
|
|
|
|
private String phone;
|
|
|
|
|
|
|
|
@Column
|
|
|
|
@JsonIgnore
|
|
|
|
private String mobileEndpointArn;
|
|
|
|
|
|
|
|
@Column
|
|
|
|
@JsonIgnore
|
|
|
|
private String mobileEndpointSubscriptionArn;
|
|
|
|
|
|
|
|
@Column(nullable = false)
|
|
|
|
private String occupation;
|
|
|
|
}
|
|
|
|
```
|
|
|
|
|
|
|
|
**UserAnnouncementViews**
|
|
|
|
|
|
|
|
```java
|
|
|
|
@Entity
|
|
|
|
@Table(name = "users_announcements_view")
|
|
|
|
@Data
|
|
|
|
@Builder
|
|
|
|
@NoArgsConstructor
|
|
|
|
@AllArgsConstructor
|
|
|
|
public class UserAnnouncementView {
|
|
|
|
|
|
|
|
@Id
|
|
|
|
@Column(nullable = false)
|
|
|
|
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
|
|
|
private Long id;
|
|
|
|
|
|
|
|
@ManyToOne(cascade = CascadeType.MERGE, fetch = FetchType.EAGER)
|
|
|
|
@JoinColumn(name = "idUser", referencedColumnName = "registry")
|
|
|
|
private User user;
|
|
|
|
|
|
|
|
@ManyToOne(cascade = CascadeType.REFRESH, fetch = FetchType.EAGER)
|
|
|
|
@JoinColumn(name = "idAnnouncement", referencedColumnName = "id")
|
|
|
|
private Announcement announcement;
|
|
|
|
|
|
|
|
@Column
|
|
|
|
private boolean viewed;
|
|
|
|
}
|
|
|
|
``` |
|
|
|
\ No newline at end of file |