Example #1
0
func (i *SessionInter) scopeModel(session *domain.Session) error {
	session.CreatedAt = time.Time{}
	session.UpdatedAt = time.Time{}
	session.Account = domain.Account{}

	return nil
}
func (i *AccountGuestInter) Current(currentSession *domain.Session) (*domain.Account, error) {
	filter := &usecases.Filter{
		Include: []interface{}{"users"},
	}

	account, err := i.repo.FindByID(currentSession.AccountID, usecases.QueryContext{Filter: filter})
	if err != nil {
		return nil, err
	}

	currentSession.Account = domain.Account{}
	account.Sessions = []domain.Session{*currentSession}

	return account, nil
}