1
|
package repository
|
1
|
package repository
|
2
|
|
2
|
|
3
|
import (
|
3
|
import (
|
|
|
4
|
+ "time"
|
|
|
5
|
+
|
4
|
pgTransaction "github.com/linmadan/egglib-go/transaction/pg"
|
6
|
pgTransaction "github.com/linmadan/egglib-go/transaction/pg"
|
5
|
"gitlab.fjmaimaimai.com/allied-creation/performance/pkg/domain"
|
7
|
"gitlab.fjmaimaimai.com/allied-creation/performance/pkg/domain"
|
6
|
"gitlab.fjmaimaimai.com/allied-creation/performance/pkg/infrastructure/pg/models"
|
8
|
"gitlab.fjmaimaimai.com/allied-creation/performance/pkg/infrastructure/pg/models"
|
|
@@ -16,24 +18,6 @@ func NewLogSmsRepository(transactionContext *pgTransaction.TransactionContext) * |
|
@@ -16,24 +18,6 @@ func NewLogSmsRepository(transactionContext *pgTransaction.TransactionContext) * |
16
|
|
18
|
|
17
|
var _ domain.LogSmsRepository = (*LogSmsRepository)(nil)
|
19
|
var _ domain.LogSmsRepository = (*LogSmsRepository)(nil)
|
18
|
|
20
|
|
19
|
-func (repo *LogSmsRepository) Insert(param *domain.LogSms) error {
|
|
|
20
|
- m := models.LogSms{
|
|
|
21
|
- Id: param.Id,
|
|
|
22
|
- Phone: param.Phone,
|
|
|
23
|
- TemplateId: param.TemplateId,
|
|
|
24
|
- Template: param.Template,
|
|
|
25
|
- Value: param.Value,
|
|
|
26
|
- CreatedAt: param.CreatedAt,
|
|
|
27
|
- Result: param.Result,
|
|
|
28
|
- }
|
|
|
29
|
- tx := repo.transactionContext.PgTx
|
|
|
30
|
- _, err := tx.Model(&m).Insert()
|
|
|
31
|
- if err != nil {
|
|
|
32
|
- return err
|
|
|
33
|
- }
|
|
|
34
|
- return nil
|
|
|
35
|
-}
|
|
|
36
|
-
|
|
|
37
|
func (repo *LogSmsRepository) Save(param *domain.LogSms) error {
|
21
|
func (repo *LogSmsRepository) Save(param *domain.LogSms) error {
|
38
|
m := models.LogSms{
|
22
|
m := models.LogSms{
|
39
|
Id: param.Id,
|
23
|
Id: param.Id,
|
|
@@ -43,6 +27,10 @@ func (repo *LogSmsRepository) Save(param *domain.LogSms) error { |
|
@@ -43,6 +27,10 @@ func (repo *LogSmsRepository) Save(param *domain.LogSms) error { |
43
|
Value: param.Value,
|
27
|
Value: param.Value,
|
44
|
CreatedAt: param.CreatedAt,
|
28
|
CreatedAt: param.CreatedAt,
|
45
|
Result: param.Result,
|
29
|
Result: param.Result,
|
|
|
30
|
+ Status: string(param.Status),
|
|
|
31
|
+ From: param.From,
|
|
|
32
|
+ Index: param.Index,
|
|
|
33
|
+ ExecuteAt: time.Time{},
|
46
|
}
|
34
|
}
|
47
|
tx := repo.transactionContext.PgTx
|
35
|
tx := repo.transactionContext.PgTx
|
48
|
_, err := tx.Model(&m).Insert()
|
36
|
_, err := tx.Model(&m).Insert()
|