aboutsummaryrefslogtreecommitdiff
path: root/cmd/mi/models/member.go
blob: cbce48b9383a978e863f495137879fb3ab2f0c17 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
package models

import (
	pb "within.website/x/proto/mi"
)

// Member is a member of the Within system.
type Member struct {
	ID        int    // unique number to use as a primary key
	Name      string `gorm:"uniqueIndex"` // the name of the member
	AvatarURL string // public URL to the member's avatar
}

// AsProto converts a Member to its protobuf representation.
func (m Member) AsProto() *pb.Member {
	return &pb.Member{
		Id:        int32(m.ID),
		Name:      m.Name,
		AvatarUrl: m.AvatarURL,
	}
}