/
test_campaign_document.go
47 lines (40 loc) · 1.09 KB
/
test_campaign_document.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
package mongodb
import (
"time"
"github.com/harpyd/thestis/internal/core/app/query"
"github.com/harpyd/thestis/internal/core/entity/testcampaign"
)
type testCampaignDocument struct {
ID string `bson:"_id,omitempty"`
ViewName string `bson:"viewName"`
Summary string `bson:"summary"`
OwnerID string `bson:"ownerId"`
CreatedAt time.Time `bson:"createdAt"`
}
func newTestCampaignDocument(tc *testcampaign.TestCampaign) testCampaignDocument {
return testCampaignDocument{
ID: tc.ID(),
ViewName: tc.ViewName(),
Summary: tc.Summary(),
OwnerID: tc.OwnerID(),
CreatedAt: tc.CreatedAt(),
}
}
func newTestCampaign(d testCampaignDocument) *testcampaign.TestCampaign {
tc, _ := testcampaign.New(testcampaign.Params{
ID: d.ID,
ViewName: d.ViewName,
Summary: d.Summary,
OwnerID: d.OwnerID,
CreatedAt: d.CreatedAt,
})
return tc
}
func newSpecificTestCampaignView(d testCampaignDocument) query.TestCampaignModel {
return query.TestCampaignModel{
ID: d.ID,
ViewName: d.ViewName,
Summary: d.Summary,
CreatedAt: d.CreatedAt,
}
}