forked from ebhomengo/niki
refactor
This commit is contained in:
parent
891cbf098f
commit
df292897ed
|
|
@ -16,8 +16,10 @@ func New(db *mysql.DB) *DB {
|
|||
return &DB{conn: db}
|
||||
}
|
||||
|
||||
|
||||
|
||||
// CreateCampaign creates a new campaign
|
||||
func (d *DB) CreateCampaign(ctx context.Context, campaign entity.Campaign) (types.ID, error) {
|
||||
func (d *DB) CreateAndSave(ctx context.Context, campaign entity.Campaign) (types.ID, error) {
|
||||
const Op = "repository.mysql.campaign.create"
|
||||
|
||||
tx, err := d.conn.Conn().BeginTx(ctx, nil)
|
||||
|
|
@ -58,6 +60,8 @@ func (d *DB) CreateCampaign(ctx context.Context, campaign entity.Campaign) (type
|
|||
return types.ID(campaignID), nil
|
||||
}
|
||||
|
||||
|
||||
|
||||
// Create adds a new participant to a campaign
|
||||
func (d *DB) CreateCampaignParticipants(ctx context.Context, participant entity.CampaignParticipant) (types.ID, error) {
|
||||
const Op = "repository.mysql.campaign_participant.create"
|
||||
|
|
|
|||
|
|
@ -19,7 +19,6 @@ import (
|
|||
|
||||
type CampaignService struct {
|
||||
repo repository.CampaignRepository
|
||||
participantRepo repository.CampaignParticipantRepository
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue