Skip to content

Commit

Permalink
Some more bug fixes.
Browse files Browse the repository at this point in the history
  • Loading branch information
FruTooTi committed Dec 9, 2023
1 parent 7378ba5 commit 4382fe0
Show file tree
Hide file tree
Showing 12 changed files with 28 additions and 23 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,11 @@
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.autoconfigure.domain.EntityScan;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.context.annotation.ComponentScan;

@SpringBootApplication
public class EhayvanBackendApiApplication {

public static void main(String[] args) {
SpringApplication.run(EhayvanBackendApiApplication.class, args);
}

}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package Entities;
package com.production.ehayvanbackendapi.Entities;

import jakarta.persistence.*;
import net.sf.jsqlparser.expression.DateTimeLiteralExpression;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package Entities;
package com.production.ehayvanbackendapi.Entities;

import jakarta.persistence.*;

Expand All @@ -12,7 +12,7 @@ public class MedType{
private int MedTypeID;
@Column(nullable = false)
private String MedType;
@OneToMany(mappedBy = "Medication")
@OneToMany(mappedBy = "MedTypeID")
private List<Medication> medications;

public int getMedTypeID() {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
package Entities;
package com.production.ehayvanbackendapi.Entities;

import jakarta.persistence.*;

@Entity
@Table(name="Medication")

public class Medication {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package Entities;
package com.production.ehayvanbackendapi.Entities;

import jakarta.persistence.*;

Expand All @@ -16,8 +16,13 @@ public class Pet {
@JoinColumn(name = "PetTypeID", referencedColumnName = "PetTypeID")
private PetType PetTypeID;
private String Description;
@OneToMany(mappedBy = "Appointments")
@ManyToOne
@JoinColumn(name = "PetOwnerID", referencedColumnName = "PetOwnerID")
private PetOwner PetOwnerID;
@OneToMany(mappedBy = "PetID")
private List<Appointment> Appointments;
@OneToMany(mappedBy = "PetID")
private List<Medication> Medications;

public int getPetID() {
return PetID;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package Entities;
package com.production.ehayvanbackendapi.Entities;

import jakarta.persistence.*;

Expand Down Expand Up @@ -27,10 +27,10 @@ public int getPetOwnerID() {
public void setPetOwnerID(int petOwnerID) {
PetOwnerID = petOwnerID;
}
public Entities.User getUser() {
public com.production.ehayvanbackendapi.Entities.User getUser() {
return User;
}
public void setUser(Entities.User user) {
public void setUser(com.production.ehayvanbackendapi.Entities.User user) {
User = user;
}
public List<Pet> getPets() {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package Entities;
package com.production.ehayvanbackendapi.Entities;

import jakarta.persistence.*;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package Entities;
package com.production.ehayvanbackendapi.Entities;

import jakarta.persistence.*;
import net.sf.jsqlparser.expression.DateTimeLiteralExpression;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package Entities;
package com.production.ehayvanbackendapi.Entities;

import jakarta.persistence.*;

Expand All @@ -19,9 +19,9 @@ public class User {
@ManyToOne
@JoinColumn(name = "UserTypeID", referencedColumnName = "UserTypeID")
private UserType UserTypeID;
@OneToOne(mappedBy = "Veterinarian")
@OneToOne(mappedBy = "User")
private Veterinarian Vet;
@OneToOne(mappedBy = "PetOwner")
@OneToOne(mappedBy = "User")
private PetOwner Owner;

public int getUserID() {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package Entities;
package com.production.ehayvanbackendapi.Entities;

import jakarta.persistence.*;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package Entities;
package com.production.ehayvanbackendapi.Entities;

import jakarta.persistence.*;

Expand All @@ -10,14 +10,14 @@ public class Veterinarian{
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private int VetID;
@OneToMany(mappedBy = "VetID")
@OneToMany(mappedBy = "Vet")
private List<PetOwner> PetOwners;
@Column(nullable = false)
private String Clinic;
@OneToOne(cascade = CascadeType.ALL)
@JoinColumn(name = "UserID", referencedColumnName = "UserID")
private User User;
@OneToMany(mappedBy = "Veterinarian")
@OneToMany(mappedBy = "VetID")
private List<Appointment> Appointments;

public String getClinic() {
Expand Down
6 changes: 4 additions & 2 deletions src/main/resources/application.properties
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ spring.datasource.url=jdbc:postgresql://ehayvan-instance-1.cec0hgebpm1w.eu-north
spring.datasource.username=postgres
spring.datasource.password=12345678
spring.datasource.driver-class-name=org.postgresql.Driver
spring.jpa.properties.hibernate.dialect = org.hibernate.dialect.MySQL5Dialect
spring.jpa.generate-ddl=true
spring.jpa.hibernate.ddl-auto = create
spring.jpa.hibernate.ddl-auto=update
spring.jpa.properties.hibernate.jdbc.lob.non_contextual_creation=true
spring.jpa.properties.hibernate.dialect= org.hibernate.dialect.PostgreSQLDialect

0 comments on commit 4382fe0

Please sign in to comment.