ui overhaul
This commit is contained in:
@@ -135,8 +135,8 @@ func (s *Service) CreateCard(ctx context.Context, listID int64, title, descripti
|
||||
return domain.Card{}, err
|
||||
}
|
||||
now := timestamp()
|
||||
result, err := tx.ExecContext(ctx, `INSERT INTO cards (list_id, title, description, position, done, created_at, updated_at)
|
||||
VALUES (?, ?, ?, ?, 0, ?, ?)`, listID, title, description, pos, now, now)
|
||||
result, err := tx.ExecContext(ctx, `INSERT INTO cards (list_id, title, description, position, created_at, updated_at)
|
||||
VALUES (?, ?, ?, ?, ?, ?)`, listID, title, description, pos, now, now)
|
||||
if err != nil {
|
||||
return domain.Card{}, err
|
||||
}
|
||||
@@ -154,7 +154,6 @@ func (s *Service) CreateCard(ctx context.Context, listID int64, title, descripti
|
||||
type CardPatch struct {
|
||||
Title *string
|
||||
Description *string
|
||||
Done *bool
|
||||
ListID *int64
|
||||
Position *float64
|
||||
}
|
||||
@@ -189,9 +188,6 @@ func (s *Service) UpdateCard(ctx context.Context, id int64, patch CardPatch) (do
|
||||
if patch.Description != nil {
|
||||
card.Description = *patch.Description
|
||||
}
|
||||
if patch.Done != nil {
|
||||
card.Done = *patch.Done
|
||||
}
|
||||
if patch.ListID != nil {
|
||||
if _, err := store.List(ctx, tx, *patch.ListID); err != nil {
|
||||
return domain.Card{}, err
|
||||
@@ -207,12 +203,8 @@ func (s *Service) UpdateCard(ctx context.Context, id int64, patch CardPatch) (do
|
||||
}
|
||||
card.Position = pos + positionStep
|
||||
}
|
||||
done := 0
|
||||
if card.Done {
|
||||
done = 1
|
||||
}
|
||||
if _, err := tx.ExecContext(ctx, `UPDATE cards SET list_id = ?, title = ?, description = ?, position = ?, done = ?, updated_at = ? WHERE id = ?`,
|
||||
card.ListID, card.Title, card.Description, card.Position, done, timestamp(), id); err != nil {
|
||||
if _, err := tx.ExecContext(ctx, `UPDATE cards SET list_id = ?, title = ?, description = ?, position = ?, updated_at = ? WHERE id = ?`,
|
||||
card.ListID, card.Title, card.Description, card.Position, timestamp(), id); err != nil {
|
||||
return domain.Card{}, err
|
||||
}
|
||||
if err := normalizeCards(ctx, tx, sourceListID); err != nil {
|
||||
|
||||
Reference in New Issue
Block a user