feat(csat): queue channel templates
This commit is contained in:
@@ -19,6 +19,8 @@ func NewCsatTemplateRepo(db *gorm.DB) *CsatTemplateRepo {
|
||||
return &CsatTemplateRepo{db: db}
|
||||
}
|
||||
|
||||
func (r *CsatTemplateRepo) DB() *gorm.DB { return r.db }
|
||||
|
||||
// Create inserts a new CSAT template.
|
||||
func (r *CsatTemplateRepo) Create(ctx context.Context, template *model.CsatTemplate) error {
|
||||
return r.db.WithContext(ctx).Create(template).Error
|
||||
@@ -35,6 +37,15 @@ func (r *CsatTemplateRepo) FindByInbox(ctx context.Context, inboxID uint) (*mode
|
||||
return &template, nil
|
||||
}
|
||||
|
||||
func (r *CsatTemplateRepo) FindByID(ctx context.Context, id uint) (*model.CsatTemplate, error) {
|
||||
var template model.CsatTemplate
|
||||
err := r.db.WithContext(ctx).First(&template, id).Error
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &template, nil
|
||||
}
|
||||
|
||||
// FindByInboxAndID retrieves a CSAT template by inbox and primary key.
|
||||
func (r *CsatTemplateRepo) FindByInboxAndID(ctx context.Context, inboxID uint, id uint) (*model.CsatTemplate, error) {
|
||||
var template model.CsatTemplate
|
||||
@@ -53,4 +64,4 @@ func (r *CsatTemplateRepo) Update(ctx context.Context, template *model.CsatTempl
|
||||
// Delete removes a CSAT template by primary key.
|
||||
func (r *CsatTemplateRepo) Delete(ctx context.Context, id uint) error {
|
||||
return r.db.WithContext(ctx).Delete(&model.CsatTemplate{}, id).Error
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user