Add Support to consume/redeem points
Support Creating task/chore via api Add initial Description for tasks
This commit is contained in:
parent
50b1357dfa
commit
ac733343da
11 changed files with 368 additions and 66 deletions
24
internal/points/repo/repository.go
Normal file
24
internal/points/repo/repository.go
Normal file
|
@ -0,0 +1,24 @@
|
|||
package points
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
pModel "donetick.com/core/internal/points"
|
||||
"gorm.io/gorm"
|
||||
)
|
||||
|
||||
type PointsRepository struct {
|
||||
db *gorm.DB
|
||||
}
|
||||
|
||||
func NewPointsRepository(db *gorm.DB) *PointsRepository {
|
||||
return &PointsRepository{db}
|
||||
}
|
||||
|
||||
func (r *PointsRepository) CreatePointsHistory(c context.Context, tx *gorm.DB, pointsHistory *pModel.PointsHistory) error {
|
||||
if tx != nil {
|
||||
return tx.Model(&pModel.PointsHistory{}).Save(pointsHistory).Error
|
||||
}
|
||||
|
||||
return r.db.WithContext(c).Save(pointsHistory).Error
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue