Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- @Document(collection="todos")
- public class Todo {
- @Id
- private String id;
- @NotBlank
- @Size(max=250)
- @Indexed(unique=true)
- private String title;
- private Boolean completed = false;
- private Date createdAt = new Date();
- public Todo() {
- super();
- }
- public Todo(String title) {
- this.title = title;
- }
- public String getId() {
- return id;
- }
- public void setId(String id) {
- this.id = id;
- }
- public String getTitle() {
- return title;
- }
- public void setTitle(String title) {
- this.title = title;
- }
- public Boolean getCompleted() {
- return completed;
- }
- public void setCompleted(Boolean completed) {
- this.completed = completed;
- }
- public Date getCreatedAt() {
- return createdAt;
- }
- public void setCreatedAt(Date createdAt) {
- this.createdAt = createdAt;
- }
- @Override
- public String toString() {
- return String.format(
- "Todo[id=%s, title='%s', completed='%s']",
- id, title, completed);
- }
- }
- @Repository
- public interface TodoRepository extends MongoRepository<Todo, String> {
- public List<Todo> findAll();
- public Todo findOne(String id);
- public Todo save(Todo todo);
- public void delete(Todo todo);
- }
- @Document(collection = "courses")
- public class Courses {
- @Id
- private String id;
- private String name;
- private String lecturer;
- private String picture;
- private String video;
- private String description;
- private String enroled;
- public Courses(){}
- public Courses(String name, String lecturer, String picture, String video, String description,String enroled) {
- this.name = name;
- this.lecturer = lecturer;
- this.picture = picture;
- this.video = video;
- this.description = description;
- this.enroled = enroled;
- }
- public String getId() {
- return id;
- }
- public void setId(String id) {
- this.id = id;
- }
- public String getName() {
- return name;
- }
- public void setName(String name) {
- this.name = name;
- }
- public String getLecturer() {
- return lecturer;
- }
- public void setLecturer(String lecturer) {
- this.lecturer = lecturer;
- }
- public String getPicture() {
- return picture;
- }
- public void setPicture(String picture) {
- this.picture = picture;
- }
- public String getVideo() {
- return video;
- }
- public void setVideo(String video) {
- this.video = video;
- }
- public String getDescription() {
- return description;
- }
- public void setDescription(String description) {
- this.description = description;
- }
- public String getEnroled() {
- return enroled;
- }
- public void setEnroled(String enroled) {
- this.enroled = enroled;
- }
- @Override
- public String toString() {
- return "Courses{" +
- "id='" + id + "'" +
- ", name='" + name + "'" +
- ", lecturer='" + lecturer + "'" +
- ", description='" + description + "'" +
- '}';
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement