-
Notifications
You must be signed in to change notification settings - Fork 0
/
domain.go
37 lines (32 loc) · 983 Bytes
/
domain.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
package domain
import (
"time"
"golang.org/x/crypto/bcrypt"
)
type User struct {
Id string `json:"id"`
Firstname string `json:"firstname"`
Lastname string `json:"lastname"`
Email string `json:"email"`
Password string `json:"password"`
Handle string `json:"handle"`
About string `json:"about"`
Contents []Content `json:"contents"`
ProfileImage string `json:"profile_image"`
Following int `json:"following"`
Followers int `json:"followers"`
}
type Content struct {
ContentId string `json:"content_id"`
CreatorId string `json:"creator_id"`
Title string `json:"title"`
Body string `json:"body"`
PublicationDate time.Time `json:"publication_date"`
}
func (u User) CheckPasswordHarsh(password string) bool {
err := bcrypt.CompareHashAndPassword([]byte(u.Password), []byte(password))
if err != nil {
return false
}
return true
}