Added event service
This commit is contained in:
parent
173c742079
commit
8da4ffeffe
@ -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;
|
||||
}
|
||||
}
|
@ -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> {
|
||||
|
||||
}
|
@ -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;
|
||||
}
|
@ -0,0 +1,5 @@
|
||||
package com.plannaplan.types;
|
||||
|
||||
public enum EventTypes {
|
||||
DROPPED_OUT, TOUR_STARTED, TRANSFER_FOUND, TOUR_FINISHED, COURSES_ACCEPTED
|
||||
}
|
Loading…
Reference in New Issue
Block a user