Update local.yaml to set is_done_tick_dot_com to false, add things history
This commit is contained in:
parent
a6871d4200
commit
17326a16a0
6 changed files with 12 additions and 13 deletions
|
@ -195,12 +195,6 @@ func (h *Handler) createChore(c *gin.Context) {
|
|||
return
|
||||
}
|
||||
|
||||
} else {
|
||||
c.JSON(400, gin.H{
|
||||
"error": "Due date is required",
|
||||
})
|
||||
return
|
||||
|
||||
}
|
||||
|
||||
freqencyMetadataBytes, err := json.Marshal(choreReq.FrequencyMetadata)
|
||||
|
|
|
@ -227,7 +227,8 @@ func (h *Handler) GetThingHistory(c *gin.Context) {
|
|||
c.JSON(400, gin.H{"error": "Invalid offset"})
|
||||
return
|
||||
}
|
||||
history, err := h.tRepo.GetThingHistoryWithOffset(c, thingID, offset, 10)
|
||||
|
||||
history, err := h.tRepo.GetThingHistoryWithOffset(c, thingID, offset)
|
||||
if err != nil {
|
||||
c.JSON(500, gin.H{"error": err.Error()})
|
||||
return
|
||||
|
|
|
@ -70,9 +70,9 @@ func (r *ThingRepository) DissociateThingWithChore(c context.Context, thingID in
|
|||
return r.db.WithContext(c).Where("thing_id = ? AND chore_id = ?", thingID, choreID).Delete(&tModel.ThingChore{}).Error
|
||||
}
|
||||
|
||||
func (r *ThingRepository) GetThingHistoryWithOffset(c context.Context, thingID int, offset int, limit int) ([]*tModel.ThingHistory, error) {
|
||||
func (r *ThingRepository) GetThingHistoryWithOffset(c context.Context, thingID int, offset int) ([]*tModel.ThingHistory, error) {
|
||||
var thingHistory []*tModel.ThingHistory
|
||||
if err := r.db.WithContext(c).Model(&tModel.ThingHistory{}).Where("thing_id = ?", thingID).Order("created_at desc").Offset(offset).Limit(limit).Find(&thingHistory).Error; err != nil {
|
||||
if err := r.db.WithContext(c).Model(&tModel.ThingHistory{}).Where("thing_id = ?", thingID).Order("created_at desc").Offset(offset).Limit(10).Find(&thingHistory).Error; err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return thingHistory, nil
|
||||
|
|
|
@ -58,7 +58,7 @@ func (r *UserRepository) GetUserByUsername(c context.Context, username string) (
|
|||
return nil, err
|
||||
}
|
||||
} else {
|
||||
if err := r.db.WithContext(c).Where("username = ?", username).First(&user).Error; err != nil {
|
||||
if err := r.db.WithContext(c).Table("users u").Select("u.*, 'active' as subscription, '2999-12-31' as expiration").Where("username = ?", username).First(&user).Error; err != nil {
|
||||
return nil, err
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue