File size: 1,243 Bytes
131eba4
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
package models

import (
	"time"

	uuid "github.com/satori/go.uuid"
)

type Account struct {
	Id                uint       `gorm:"primaryKey" json:"id"`
	UUID              uuid.UUID  `gorm:"type:uuid" json:"uuid" `
	Email             string     `gorm:"uniqueIndex" json:"email"`
	Password          string     `json:"password"`
	Role              string     `json:"role"`
	IsDetailCompleted bool       `json:"is_detail_completed"`
	CreatedAt         time.Time  `json:"created_at"`
	DeletedAt         *time.Time `json:"deleted_at" gorm:"default:null"`
}

type AccountDetails struct {
	ID           uint       `gorm:"primaryKey" json:"id"`
	AccountId    uint       `json:"account_id"`
	InitialName  string     `json:"initial_name"`
	FullName     *string    `json:"full_name"`
	Address      *string    `json:"address"`
	Gender       bool       `json:"gender"`
	University   *string    `json:"university"`
	DateOfBirth  *time.Time `json:"date_of_birth"`
	PlaceOfBirth *string    `json:"place_of_birth"`
	PhoneNumber  *string    `json:"phone_number"`
}

// Gorm table name settings
func (Account) TableName() string        { return "account" }
func (AccountDetails) TableName() string { return "account_details" }