Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -31,3 +31,6 @@ build/

### VS Code ###
.vscode/

### Fichier properties ###
*.properties
14 changes: 13 additions & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,19 @@
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
<dependency>
<groupId>org.postgresql</groupId>
<artifactId>postgresql</artifactId>
</dependency>
<dependency>
<groupId>org.flywaydb</groupId>
<artifactId>flyway-core</artifactId>
</dependency>
<dependency>
<groupId>org.flywaydb</groupId>
<artifactId>flyway-database-postgresql</artifactId>
</dependency>
</dependencies>

<build>
<plugins>
Expand Down
72 changes: 72 additions & 0 deletions src/main/java/fr/host_dcode/vlib/model/Station.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
package fr.host_dcode.vlib.model;


import jakarta.persistence.Entity;
import jakarta.persistence.GeneratedValue;
import jakarta.persistence.GenerationType;
import jakarta.persistence.Id;

import java.time.LocalDateTime;

@Entity
public class Station {

@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private int id;
private String name;
private String station_code;
private double latitude;
private double longitude;
private String address;
private String city;
private String description;
private LocalDateTime last_update;


public Station(){}

public Station(String name, String stationCode, double latitude, double longitude, String description) {
this.name = name;
this.station_code = stationCode;
this.latitude = latitude;
this.longitude = longitude;
this.description = description;
}

public String getStationCode(){
return this.station_code;
}

public String getName(){
return this.name;
}

public void setName(String name){
this.name = name;
}

public String getDescription(){
return this.description;
}

public void setDescription(String description){
this.description = description;
}
public Double getLatitude(){
return this.latitude;
}
public Double getLongitude(){
return this.longitude;
}

public String getAddress(){
return this.address;
}

public void setAddress(String address){
this.address = address;
}


}
6 changes: 6 additions & 0 deletions src/main/java/fr/host_dcode/vlib/model/Status.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
package fr.host_dcode.vlib.model;

public enum Status {
User,
Admin
}
37 changes: 37 additions & 0 deletions src/main/java/fr/host_dcode/vlib/model/User.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
package fr.host_dcode.vlib.model;

import jakarta.persistence.*;

import java.time.LocalDateTime;

@Entity
@Table(name = "users")
public class User {

@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private int id;
private String email;
private String password;
private Status status;
private LocalDateTime created_at;


public User(){}

public User(String email, String password){
this.email = email;
this.password = password;
}

public String getEmail(){
return this.email;
}

public Status getStatus(){
return this.status;
}



}
1 change: 0 additions & 1 deletion src/main/resources/application.properties

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
CREATE TABLE users (
id SERIAL PRIMARY KEY,
email VARCHAR(50) NOT NULL,
password VARCHAR(200) NOT NULL,
status VARCHAR(20) NOT NULL,
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP
);

CREATE TABLE station (
id SERIAL PRIMARY KEY,
name VARCHAR(100) NOT NULL,
station_code VARCHAR(20) NOT NULL,
latitude DECIMAL(9,6) NOT NULL,
longitude DECIMAL(9,6) NOT NULL,
address VARCHAR(100),
city VARCHAR(20),
description VARCHAR(300),
last_update TIMESTAMP DEFAULT CURRENT_TIMESTAMP
);