feat: 实现账本服务和仓库层,提供账本的创建、查询、更新、删除和恢复功能。

This commit is contained in:
2026-01-31 12:18:26 +08:00
parent f6d2a9b6ca
commit 708694056e
2 changed files with 9 additions and 1 deletions

View File

@@ -83,7 +83,7 @@ func (s *LedgerService) CreateLedger(userID uint, input LedgerInput) (*models.Le
// If this is set as default, we need to unset other defaults
if input.IsDefault {
if err := s.repo.SetDefault(userID, 0); err != nil {
if err := s.repo.UnsetAllDefaults(userID); err != nil {
return nil, fmt.Errorf("failed to unset default ledgers: %w", err)
}
}