Added event service

This commit is contained in:
Filip Izydorczyk 2020-07-27 16:19:31 +02:00
parent 173c742079
commit 8da4ffeffe
4 changed files with 60 additions and 0 deletions

View File

@ -0,0 +1,32 @@
package com.plannaplan.entities;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import com.plannaplan.types.EventTypes;
@Entity
public class Event {
@Id
@GeneratedValue(strategy = GenerationType.AUTO)
private Long id;
private EventTypes type;
@ManyToOne
@JoinColumn(name = "user_id")
private User user;
public Event() {
}
public EventTypes getType() {
return type;
}
public void setType(EventTypes type) {
this.type = type;
}
}

View File

@ -0,0 +1,11 @@
package com.plannaplan.repositories;
import com.plannaplan.entities.Event;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.stereotype.Repository;
@Repository
public interface EventRepository extends JpaRepository<Event, Long> {
}

View File

@ -0,0 +1,12 @@
package com.plannaplan.services;
import com.plannaplan.repositories.EventRepository;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
@Service
public class EventService {
@Autowired
private EventRepository repo;
}

View File

@ -0,0 +1,5 @@
package com.plannaplan.types;
public enum EventTypes {
DROPPED_OUT, TOUR_STARTED, TRANSFER_FOUND, TOUR_FINISHED, COURSES_ACCEPTED
}