This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
err = api.Storage.Profile().Update(ctx, user) | |
if err != nil { | |
api.Logger.WithFields(logrus.Fields{"err": err}).Error("Update failed") | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// IStorage represents database methods | |
type IStorage interface { | |
Feedback() Feedback | |
// this is just a temporary change not to break all the functionality. Will reimplment this | |
// for the version mentioned above as a next step with just a small chucks under improvements | |
User | |
Profile | |
Agreement | |
AgreementChange |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// IStorage represents database methods | |
type IStorage interface { | |
// User() User | |
// Profile() Profile | |
// Agreement() Agreement | |
// AgreementChanges() AgreementChange | |
// Milestone() Milestone | |
// Contact() Contact | |
// Notifications() Notification | |
// Payout() Payout |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// IStorage represents database methods | |
type IStorage interface { | |
IfUserCanBeDeleted(ctx context.Context, userID int64) (bool, error) | |
CreateUser(ctx context.Context, u *model.User) (model.User, error) | |
CreateProfile(ctx context.Context, item *model.Profile) (*model.Profile, error) | |
DeleteUser(ctx context.Context, id int64) error | |
MarkUserAsDeleted(ctx context.Context, id int64, reason string) error | |
ListProfiles(ctx context.Context) ([]model.Profile, error) | |
UpdateProfile(ctx context.Context, item *model.Profile) error | |
GetUserByID(ctx context.Context, id int64) (model.User, error) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// IStorage represents database methods | |
type IStorage interface { | |
User() User | |
Profile() Profile | |
Agreement() Agreement | |
AgreementChanges() AgreementChanges | |
Milestone() Milestone | |
Contact() Contact | |
Notification() Notification | |
Payout() Payout |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
mysqldump --complete-insert --host=localhost --user=root --password=root --no-create-info database | sed -e "s/([0-9]*,/(NULL,/gi" > database.sql |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
func (s *Slack) Run() { | |
s.UpdateUsersList() | |
s.SendUserMessage(s.Conf.ManagerSlackUserID, s.Conf.Translate.HelloManager) | |
gocron.Every(1).Day().At("23:50").Do(s.FillStandupsForNonReporters) | |
gocron.Every(1).Day().At("23:55").Do(s.UpdateUsersList) | |
gocron.Start() | |
s.WG.Add(1) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import "sync" | |
func main() { | |
var wg sync.WaitGroup | |
wg.Add(1) | |
ch := make(chan int) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
func TestHandleUserCommands(t *testing.T) { | |
AddUser := "command=/comedianadd&text=<@userid|test>&channel_id=chanid&channel_name=channame" | |
AddEmptyText := "command=/comedianadd&text=" | |
AddUserEmptyChannelID := "command=/comedianadd&text=test&channel_id=&channel_name=channame" | |
AddUserEmptyChannelName := "command=/comedianadd&text=test&channel_id=chanid&channel_name=" | |
DelUser := "command=/comedianremove&text=@test&channel_id=chanid" | |
ListUsers := "command=/comedianlist&channel_id=chanid" | |
c, err := config.Get() | |
rest, err := NewRESTAPI(c) |