member

package
v1.0.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 7, 2021 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Overview

Package member provides access to the club member of the Buddy System.

Package member provides access to the club member of the Buddy System.

Index

Constants

View Source
const (
	MASTER    = "MASTER"
	Attending = iota
	Absent
	Graduate
)

Variables

View Source
var (
	ErrIdentityMismatch = errors.New("계정 정보를 확인해주세요")
	ErrAlreadyMember    = errors.New("이미 등록된 사용자입니다")
	ErrUnderReview      = errors.New("승인 검토 중입니다")
	ErrOnDelete         = errors.New("이미 탈퇴 신청하셨습니다")
	ErrAlreadyActive    = errors.New("already active")
	ErrAlreadyInactive  = errors.New("already inactive")
	ErrPermissionDenied = errors.New("권한이 없습니다")
)

Functions

func Activate

func Activate(activate bool) (bool, error)

Activate updates the activation status for member signup.

NOTE:

It is a privileged operation:

Only the club managers can access to this operation.

func Active

func Active() (bool, error)

Active returns the activation status for member signup.

func Approve

func Approve(ids []string) error

Approve approves the signup requests of ids.

NOTE:

It is a privileged operation:

Only the club managers can access to this operation.

func Delete

func Delete(ids []string) error

Delete deletes the members of ids.

NOTE:

It is a privileged operation:

Only the club managers can access to this operation.

func UpdateRole

func UpdateRole(id string, role Role) error

UpdateRole updates the role of member of id.

NOTE:

It is a privileged operation:

Only the club managers can access to this operation.

Types

type Member

type Member struct {
	ID         string `json:"id" bson:"id"`                        // student ID
	Password   string `json:"password" bson:"password"`            // password
	Name       string `json:"name" bson:"name"`                    // Name
	Department string `json:"department" bson:"department"`        // department
	Phone      string `json:"phone" bson:"phone"`                  // phone number
	Email      string `json:"email" bson:"email"`                  // e-mail address
	Grade      int    `json:"grade" bson:"grade"`                  // grade
	Attendance int    `json:"attendance" bson:"attendance"`        // attendance status (attending/absent/graduate)
	Approved   bool   `json:"approved" bson:"approved"`            // approved or not
	OnDelete   bool   `json:"on_delete" bson:"on_delete"`          // on exit process or not
	CreatedAt  int64  `json:"created_at,string" bson:"created_at"` // when created - Unix timestamp
	UpdatedAt  int64  `json:"updated_at,string" bson:"updated_at"` // last updated - Unix timestamp
	Role       Role   `json:"role" bson:"role"`                    // role of member
}

Member represents a club member state.

func New

func New(id, name, department, phone, email string, grade, attendance int) *Member

New returns a new club member.

func (*Member) Exit

func (m *Member) Exit() error

Exit applies an exit of m.

NOTE:

It is a member-limited operation:

Only the authenticated members can access to this operation.

func (*Member) My

func (m *Member) My() (map[string]interface{}, error)

My returns the personal information of m.

func (Member) Public

func (m Member) Public() map[string]interface{}

Public returns the limited informations of m.

func (Member) SignUp

func (m Member) SignUp() error

SignUp applies a membership of m. If m already exists (approved or not), nothing changes. Else it registers an unapproved member.

func (Member) SingIn

func (m Member) SingIn() error

SingIn checks whether m is a club member.

NOTE:

It is a member-limited operation:

Only the authenticated members can access to this operation.

func (Member) String

func (m Member) String() string

String implements fmt.Stringer.

func (Member) Update

func (m Member) Update(update map[string]interface{}) error

Update updates the state of m to update.

NOTE:

It is a member-limited operation:

Only the authenticated members can access to this operation.

type Members

type Members []Member

func Exits

func Exits() (members Members, err error)

Exits returns the exit request list.

NOTE:

It is a privileged operation:

Only the club managers can access to this operation.

func Graduates

func Graduates() (members Members, err error)

Graduates returns all graduate members.

NOTE:

It is a privileged operation:

Only the club managers can access to this operation.
func Search(query string) (members Members, err error)

Search returns the search result with query.

NOTE:

It is a member-limited operation:

Only the authenticated members can access to this operation.

func SignUps

func SignUps() (members Members, err error)

SignUps returns the signup request list.

NOTE:

It is a privileged operation:

Only the club managers can access to this operation.

func (Members) Public

func (ms Members) Public() []map[string]interface{}

Public returns the limited informations of ms.

type Role

type Role struct {
	Master             bool `json:"-" bson:"master"`
	MemberManagement   bool `json:"member_management" bson:"member_management"`
	ActivityManagement bool `json:"activity_management" bson:"activity_management"`
	FeeManagement      bool `json:"fee_management" bson:"fee_management"`
}

Role represents the member role.

func NewRole

func NewRole() *Role

NewRole returns a new role without any authorities.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL