chore: add shortcut creator field

This commit is contained in:
Steven
2022-09-17 11:35:44 +08:00
parent de83467c45
commit 273bfb1d13
6 changed files with 46 additions and 11 deletions

View File

@ -46,6 +46,20 @@ func (raw *shortcutRaw) toShortcut() *api.Shortcut {
}
}
func (s *Store) ComposeShortcut(ctx context.Context, shortcut *api.Shortcut) error {
user, err := s.FindUser(ctx, &api.UserFind{
ID: &shortcut.CreatorID,
})
if err != nil {
return err
}
user.OpenID = ""
user.UserSettingList = nil
shortcut.Creator = user
return nil
}
func (s *Store) CreateShortcut(ctx context.Context, create *api.ShortcutCreate) (*api.Shortcut, error) {
tx, err := s.db.BeginTx(ctx, nil)
if err != nil {