Merge pull request #167 from gophish/163-allow-position-in-campaigns

Adding position attribute for models.Result.
pull/169/head
Jordan Wright 2016-02-17 21:29:47 -06:00
commit 3798896042
3 changed files with 10 additions and 1 deletions

View File

@ -0,0 +1,8 @@
-- +goose Up
-- SQL in section 'Up' is executed when this migration is applied
ALTER TABLE results ADD COLUMN position VARCHAR(255);
-- +goose Down
-- SQL section 'Down' is executed when this migration is rolled back

View File

@ -228,7 +228,7 @@ func PostCampaign(c *Campaign, uid int64) error {
for _, g := range c.Groups {
// Insert a result for each target in the group
for _, t := range g.Targets {
r := &Result{Email: t.Email, Status: STATUS_SENDING, CampaignId: c.Id, UserId: c.UserId, FirstName: t.FirstName, LastName: t.LastName}
r := &Result{Email: t.Email, Position: t.Position, Status: STATUS_SENDING, CampaignId: c.Id, UserId: c.UserId, FirstName: t.FirstName, LastName: t.LastName}
r.GenerateId()
err = db.Save(r).Error
if err != nil {

View File

@ -30,6 +30,7 @@ type Result struct {
Email string `json:"email"`
FirstName string `json:"first_name"`
LastName string `json:"last_name"`
Position string `json:"position"`
Status string `json:"status" sql:"not null"`
IP string `json:"ip"`
Latitude float64 `json:"latitude"`