github.com/vnforks/kid/v5@v5.22.1-0.20200408055009-b89d99c65676/app/terms_of_service.go (about)

     1  // Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
     2  // See LICENSE.txt for license information.
     3  
     4  package app
     5  
     6  import (
     7  	"github.com/vnforks/kid/v5/model"
     8  )
     9  
    10  func (a *App) CreateTermsOfService(text, userId string) (*model.TermsOfService, *model.AppError) {
    11  	termsOfService := &model.TermsOfService{
    12  		Text:   text,
    13  		UserId: userId,
    14  	}
    15  
    16  	if _, err := a.GetUser(userId); err != nil {
    17  		return nil, err
    18  	}
    19  
    20  	return a.Srv().Store.TermsOfService().Save(termsOfService)
    21  }
    22  
    23  func (a *App) GetLatestTermsOfService() (*model.TermsOfService, *model.AppError) {
    24  	return a.Srv().Store.TermsOfService().GetLatest(true)
    25  }
    26  
    27  func (a *App) GetTermsOfService(id string) (*model.TermsOfService, *model.AppError) {
    28  	return a.Srv().Store.TermsOfService().Get(id, true)
    29  }