This commit is contained in:
geek 2017-06-06 18:55:12 +09:00
parent 822059e897
commit 1048766d43
7 changed files with 169 additions and 3 deletions

View File

@ -0,0 +1,10 @@
package com.loafle.overflow.email.dao;
import com.loafle.overflow.commons.dao.BaseDAO;
import com.loafle.overflow.email.model.EmailAuth;
/**
* Created by geek@loafle.com on 17. 6. 6.
*/
public interface EmailAuthDAO extends BaseDAO<EmailAuth> {
}

View File

@ -0,0 +1,10 @@
package com.loafle.overflow.email.dao;
import com.loafle.overflow.commons.dao.JPABaseDAO;
import com.loafle.overflow.email.model.EmailAuth;
/**
* Created by geek@loafle.com on 17. 6. 6.
*/
public class JPAEmailAuthDAO extends JPABaseDAO<EmailAuth> implements EmailAuthDAO {
}

View File

@ -0,0 +1,103 @@
package com.loafle.overflow.email.model;
import com.loafle.overflow.member.model.Member;
import javax.persistence.*;
import java.io.Serializable;
import java.util.Date;
/**
* Created by geek@loafle.com on 17. 6. 6.
*/
@SuppressWarnings("serial")
@Entity(name="EMAIL_AUTH")
public class EmailAuth implements Serializable {
@Id
@GeneratedValue(strategy= GenerationType.IDENTITY)
private Long id;
@ManyToOne
@JoinColumn(name = "MEMBER_ID", nullable=false)
private Member member;
@Column(name="AUTH_TOKEN", unique=true, nullable=false)
private String authToken;
@Column(name = "IS_INVALID")
private Boolean isInvalid;
@Column(name = "CREATE_DATE", nullable = false, columnDefinition = "TIMESTAMP DEFAULT CURRENT_TIMESTAMP", insertable = false, updatable = false)
private Date createDate;
@Column(name = "UPDATE_DATE", nullable = false, columnDefinition = "TIMESTAMP DEFAULT CURRENT_TIMESTAMP", insertable = true, updatable = true)
private Date updateDate;
@Column(name = "CONFIRM_DATE")
private Date confirmDate;
public EmailAuth() {
}
public EmailAuth(Long id) {
this.id = id;
}
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public Member getMember() {
return member;
}
public void setMember(Member member) {
this.member = member;
}
public String getAuthToken() {
return authToken;
}
public void setAuthToken(String authToken) {
this.authToken = authToken;
}
public Boolean getInvalid() {
return isInvalid;
}
public void setInvalid(Boolean invalid) {
isInvalid = invalid;
}
public Date getCreateDate() {
return createDate;
}
public void setCreateDate(Date createDate) {
this.createDate = createDate;
}
public Date getUpdateDate() {
return updateDate;
}
public void setUpdateDate(Date updateDate) {
this.updateDate = updateDate;
}
public Date getConfirmDate() {
return confirmDate;
}
public void setConfirmDate(Date confirmDate) {
this.confirmDate = confirmDate;
}
}

View File

@ -38,6 +38,13 @@ public class Member implements Serializable {
private Long authorizedDate;
public Member() {
}
public Member(Long id) {
this.id = id;
}
public Long getId() {
return id;
}

View File

@ -0,0 +1,33 @@
package com.loafle.overflow.email.dao;
import com.loafle.overflow.email.model.EmailAuth;
import com.loafle.overflow.member.model.Member;
import org.junit.Before;
import org.junit.Test;
import static org.junit.Assert.*;
/**
* Created by root on 17. 6. 6.
*/
public class JPAEmailAuthDAOTest {
private JPAEmailAuthDAO emailAuthDAO = null;
@Before
public void before() {
this.emailAuthDAO = new JPAEmailAuthDAO();
}
@Test
public void createEmailAuth() {
EmailAuth auth = new EmailAuth();
auth.setAuthToken("loafle.com/Auth");
auth.setMember(new Member((long)1));
auth.setInvalid(false);
this.emailAuthDAO.create(auth);
}
}

View File

@ -10,6 +10,7 @@ import static org.junit.Assert.*;
/**
* Created by root on 17. 6. 4.
*/
@Ignore
public class JPAMemberDAOTest {
private JPAMemberDAO jpaMemberDAO = null;
@ -24,17 +25,17 @@ public class JPAMemberDAOTest {
public void findByEmail() throws Exception {
}
@Ignore
// @Ignore
@Test
public void createMember() {
Member m = new Member();
m.setName("insanity3");
m.setName("snnnnn");
m.setCompany("loafle");
m.setDigest("bbbbbbbbb");
m.setPwSalt("salktttt");
m.setPhone("000-000-0000");
m.setEmail("insanity33@loafle.com");
m.setEmail("ddddd@loafle.com");
this.jpaMemberDAO.create(m);
}

View File

@ -4,6 +4,7 @@ import com.loafle.overflow.member.model.Member;
import com.loafle.overflow.target.model.Target;
import com.loafle.overflow.target.type.TargetType;
import org.junit.Before;
import org.junit.Ignore;
import org.junit.Test;
import java.util.List;
@ -13,6 +14,7 @@ import static org.junit.Assert.*;
/**
* Created by root on 17. 6. 5.
*/
@Ignore
public class JPATargetDaoTest {
private JPATargetDao jpaTargetDao = null;