Finish activity class and add tests
This commit is contained in:
@@ -1,25 +0,0 @@
|
|||||||
package greenify.client.rest;
|
|
||||||
|
|
||||||
import greenify.common.ActivityDTO;
|
|
||||||
import greenify.common.ApplicationException;
|
|
||||||
import greenify.common.UserDTO;
|
|
||||||
import org.slf4j.Logger;
|
|
||||||
import org.slf4j.LoggerFactory;
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
|
||||||
|
|
||||||
public class ActivityService {
|
|
||||||
|
|
||||||
Logger logger = LoggerFactory.getLogger(greenify.server.service.ActivityService.class);
|
|
||||||
@Autowired
|
|
||||||
UserRepository userRepository;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Adds the activity to the history of the user and adds the score.
|
|
||||||
* @param name the name of the activity
|
|
||||||
* @return a activityDTO of activity.
|
|
||||||
*/
|
|
||||||
public ActivityDTO addActivity(String name) {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -1,31 +1,22 @@
|
|||||||
package greenify.server.data.model;
|
package greenify.server.data.model;
|
||||||
|
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import lombok.NoArgsConstructor;
|
|
||||||
|
|
||||||
import javax.accessibility.AccessibleValue;
|
|
||||||
import javax.persistence.*;
|
import javax.persistence.*;
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
import javax.persistence.Entity;
|
import javax.persistence.Entity;
|
||||||
import javax.persistence.GeneratedValue;
|
import javax.persistence.GeneratedValue;
|
||||||
import javax.persistence.GenerationType;
|
import javax.persistence.GenerationType;
|
||||||
import javax.persistence.Id;
|
import javax.persistence.Id;
|
||||||
import java.util.Scanner;
|
|
||||||
|
|
||||||
@Entity
|
@Entity
|
||||||
@Data
|
@Data
|
||||||
@Table(name = "activities")
|
@Table(name = "activities")
|
||||||
|
|
||||||
public class Activity {
|
public class Activity {
|
||||||
|
|
||||||
@Id
|
@Id
|
||||||
@GeneratedValue(strategy = GenerationType.AUTO)
|
@GeneratedValue(strategy = GenerationType.AUTO)
|
||||||
long id;
|
long id;
|
||||||
//@AllArgsConstructor
|
|
||||||
public abstract class Activity {
|
|
||||||
|
|
||||||
@Id
|
|
||||||
@GeneratedValue(strategy = GenerationType.AUTO)
|
|
||||||
Long id;
|
|
||||||
String name;
|
String name;
|
||||||
String description;
|
String description;
|
||||||
int score;
|
int score;
|
||||||
@@ -48,7 +39,6 @@ public abstract class Activity {
|
|||||||
* gets the id.
|
* gets the id.
|
||||||
* @return the id
|
* @return the id
|
||||||
*/
|
*/
|
||||||
|
|
||||||
public Long getId() {
|
public Long getId() {
|
||||||
return id;
|
return id;
|
||||||
}
|
}
|
||||||
@@ -110,6 +100,7 @@ public abstract class Activity {
|
|||||||
this.score = score;
|
this.score = score;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns a human readable object. It's in JSON.
|
* Returns a human readable object. It's in JSON.
|
||||||
* @return the JSON form of the object.
|
* @return the JSON form of the object.
|
||||||
@@ -140,5 +131,4 @@ public abstract class Activity {
|
|||||||
public int hashCode() {
|
public int hashCode() {
|
||||||
return Objects.hash(id, name, description, score);
|
return Objects.hash(id, name, description, score);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -1,6 +0,0 @@
|
|||||||
package greenify.server.service;
|
|
||||||
|
|
||||||
public class ActivityService {
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
Reference in New Issue
Block a user