Added more stuff.
This commit is contained in:
parent
f3aec7b2a2
commit
4eb0ddc259
|
@ -0,0 +1,25 @@
|
|||
package nl.andrewlalis.gymboard_api.model;
|
||||
|
||||
import jakarta.persistence.*;
|
||||
import org.hibernate.annotations.CreationTimestamp;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
@Entity
|
||||
@Table(name = "gym_exercise_submission")
|
||||
public class ExerciseSubmission {
|
||||
@Id
|
||||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||
private Long id;
|
||||
|
||||
@CreationTimestamp
|
||||
private LocalDateTime createdAt;
|
||||
|
||||
@Column(nullable = false, updatable = false, length = 63)
|
||||
private String submitterName;
|
||||
|
||||
@ManyToOne(optional = false, fetch = FetchType.LAZY)
|
||||
private Gym gym;
|
||||
|
||||
|
||||
}
|
|
@ -0,0 +1,38 @@
|
|||
package nl.andrewlalis.gymboard_api.model;
|
||||
|
||||
import jakarta.persistence.EmbeddedId;
|
||||
import jakarta.persistence.Entity;
|
||||
import jakarta.persistence.Table;
|
||||
import org.hibernate.annotations.CreationTimestamp;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
@Entity
|
||||
@Table(name = "gym")
|
||||
public class Gym {
|
||||
@EmbeddedId
|
||||
private GymId id;
|
||||
|
||||
@CreationTimestamp
|
||||
private LocalDateTime createdAt;
|
||||
|
||||
public GymId getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return id.getName();
|
||||
}
|
||||
|
||||
public String getCityId() {
|
||||
return id.getCityId();
|
||||
}
|
||||
|
||||
public String getCountryId() {
|
||||
return id.getCountryId();
|
||||
}
|
||||
|
||||
public LocalDateTime getCreatedAt() {
|
||||
return createdAt;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,56 @@
|
|||
package nl.andrewlalis.gymboard_api.model;
|
||||
|
||||
import jakarta.persistence.Column;
|
||||
import jakarta.persistence.Embeddable;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Objects;
|
||||
|
||||
/**
|
||||
* Compound primary key used to identify a single {@link Gym}.
|
||||
*/
|
||||
@Embeddable
|
||||
public class GymId implements Serializable {
|
||||
@Column(nullable = false, length = 127)
|
||||
private String name;
|
||||
@Column(nullable = false, length = 127)
|
||||
private String cityId;
|
||||
@Column(nullable = false, length = 2)
|
||||
private String countryId;
|
||||
|
||||
public GymId() {}
|
||||
|
||||
public GymId(String name, String cityId, String countryId) {
|
||||
this.name = name;
|
||||
this.cityId = cityId;
|
||||
this.countryId = countryId;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public String getCityId() {
|
||||
return cityId;
|
||||
}
|
||||
|
||||
public String getCountryId() {
|
||||
return countryId;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if (this == o) return true;
|
||||
if (o instanceof GymId gymId) {
|
||||
return getName().equals(gymId.getName()) &&
|
||||
getCityId().equals(gymId.getCityId()) &&
|
||||
getCountryId().equals(gymId.getCountryId());
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return Objects.hash(getName(), getCityId(), getCountryId());
|
||||
}
|
||||
}
|
|
@ -1 +1 @@
|
|||
|
||||
spring.jpa.open-in-view=false
|
||||
|
|
|
@ -28,8 +28,8 @@
|
|||
>
|
||||
Pages
|
||||
</q-item-label>
|
||||
<q-item clickable>First Page</q-item>
|
||||
<q-item clickable>Second Page</q-item>
|
||||
<q-item clickable>Gyms</q-item>
|
||||
<q-item clickable>Global Leaderboard</q-item>
|
||||
</q-list>
|
||||
</q-drawer>
|
||||
|
||||
|
|
|
@ -1,16 +1,17 @@
|
|||
<template>
|
||||
<q-page>
|
||||
Hello Gym Page
|
||||
<p>
|
||||
Leaderboard total
|
||||
</p>
|
||||
</q-page>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { defineComponent } from 'vue';
|
||||
<script setup lang="ts">
|
||||
import { defineComponent, onMounted, ref } from 'vue';
|
||||
const mountCount = ref(0);
|
||||
|
||||
export default defineComponent({
|
||||
name: 'GymPage',
|
||||
setup() {
|
||||
return {};
|
||||
}
|
||||
onMounted(() => {
|
||||
console.log("mounted");
|
||||
});
|
||||
</script>
|
|
@ -1,7 +1,10 @@
|
|||
<template>
|
||||
<q-page>
|
||||
Index
|
||||
<router-link to="/gyms/a">Test</router-link>
|
||||
<router-link to="/g/nl/groningen/trainmore-munnekeholm">Test</router-link>
|
||||
<p>
|
||||
Search bar for gyms.
|
||||
</p>
|
||||
</q-page>
|
||||
</template>
|
||||
|
||||
|
|
|
@ -13,7 +13,7 @@ const routes: RouteRecordRaw[] = [
|
|||
component: IndexPage
|
||||
},
|
||||
{
|
||||
path: 'gyms/:id',
|
||||
path: 'g/:countryId/:cityId/:gymName',
|
||||
component: GymPage
|
||||
}
|
||||
],
|
||||
|
|
Loading…
Reference in New Issue