<repo_name>prady00/QuickTest<file_sep>/src/main/java/com/prady00/emails/PackCreatedMail.java
package com.prady00.emails;

import javax.mail.MessagingException;
import javax.mail.internet.MimeMessage;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.mail.MailException;
import org.springframework.mail.javamail.JavaMailSender;
import org.springframework.mail.javamail.MimeMessageHelper;


public class PackCreatedMail implements Email {

	private String to;
	private String body;
	private String subject;
	
	@Autowired
	public JavaMailSender sender;


	public PackCreatedMail(String to, String body, String subject) {
		super();
		this.to = to;
		this.body = body;
		this.subject = subject;
	}

	@Override
	public void setSendTo(String to) {
		this.to = to;
	}

	@Override
	public void setBody(String body) {
		this.body = body;
	}

	@Override
	public void setSubject(String subject) {
		this.subject = subject;
	}

	@Override
	public void send() throws MessagingException, MailException {
		
	        MimeMessage message = sender.createMimeMessage();
	        MimeMessageHelper helper = new MimeMessageHelper(message);
	        
	        helper.setTo(this.to);
	        helper.setText(this.body);
	        helper.setSubject(this.subject);
	        
	        sender.send(message);
	   
	}
	
}
<file_sep>/src/main/java/com/prady00/test/Test.java
package com.prady00.test;

import java.util.Date;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import javax.validation.constraints.NotBlank;

import org.springframework.data.annotation.CreatedDate;
import org.springframework.data.annotation.LastModifiedDate;

@Entity
public class Test {
	
	@Id
	@GeneratedValue(strategy = GenerationType.IDENTITY)
	private int id;
	
	private int pack_id;
	
	private int number_of_questions;
	
	private String questions;
	
	private String answers;
		
	private String result;
	
	private String notes;
	
	private String slug;
	
	@Column(nullable = false, updatable = false)
	@CreatedDate
	@Temporal(TemporalType.TIMESTAMP)
	private Date createdAt;
	
	@Column(nullable = false)
	@LastModifiedDate
	@Temporal(TemporalType.TIMESTAMP)
	private Date updatedAt;

	public int getId() {
		return id;
	}

	public void setId(int id) {
		this.id = id;
	}

	public int getPack_id() {
		return pack_id;
	}

	public void setPack_id(int pack_id) {
		this.pack_id = pack_id;
	}

	public int getNumber_of_questions() {
		return number_of_questions;
	}

	public void setNumber_of_questions(int number_of_questions) {
		this.number_of_questions = number_of_questions;
	}

	public String getQuestions() {
		return questions;
	}

	public void setQuestions(String questions) {
		this.questions = questions;
	}

	public String getAnswers() {
		return answers;
	}

	public void setAnswers(String answers) {
		this.answers = answers;
	}

	public String getResult() {
		return result;
	}

	public void setResult(String result) {
		this.result = result;
	}

	public String getNotes() {
		return notes;
	}

	public void setNotes(String notes) {
		this.notes = notes;
	}

	public String getSlug() {
		return slug;
	}

	public void setSlug(String slug) {
		this.slug = slug;
	}

	public Date getCreatedAt() {
		return createdAt;
	}

	public void setCreatedAt(Date createdAt) {
		this.createdAt = createdAt;
	}

	public Date getUpdatedAt() {
		return updatedAt;
	}

	public void setUpdatedAt(Date updatedAt) {
		this.updatedAt = updatedAt;
	}
	
	

}
<file_sep>/src/main/java/com/prady00/exceptions/UserAlreadyRequestedPack.java
package com.prady00.exceptions;

import org.springframework.http.HttpStatus;
import org.springframework.web.bind.annotation.ResponseStatus;

@ResponseStatus(code=HttpStatus.BAD_REQUEST)
public class UserAlreadyRequestedPack extends Exception {
	
	public UserAlreadyRequestedPack(String str) {
		super(str);
	}

}
<file_sep>/src/main/java/com/prady00/pack/PackRepository.java
package com.prady00.pack;

import java.util.List;

import org.springframework.data.jpa.repository.JpaRepository;

public interface PackRepository extends JpaRepository<Pack, Long>{

	List<Pack> findAllByEmail(String email);

}
<file_sep>/README.md
# QuickTest
Springboot based APIs for creating multiple choice tests 
