Compare commits

4 Commits

Author SHA1 Message Date
8e691a4174 ct int64로 변경 2025-08-19 08:23:07 +09:00
887a28aef5 Revert "ct int64로 변경"
This reverts commit 4aae3704e7.
2025-08-19 07:18:17 +09:00
4aae3704e7 ct int64로 변경 2025-08-19 07:14:59 +09:00
962ed0cf71 생성일시 전달하는 코드 추가 2025-08-19 05:52:40 +09:00

View File

@ -6,6 +6,7 @@ import (
"encoding/hex"
"errors"
"math/rand"
"strconv"
"strings"
"time"
@ -20,7 +21,7 @@ type Authorization struct {
Platform string `bson:"p" json:"p"`
Uid string `bson:"u" json:"u"`
Alias string `bson:"al" json:"al"`
CreatedTime primitive.DateTime `bson:"ct" json:"ct"`
CreatedTime int64 `bson:"ct" json:"ct"`
}
func (auth *Authorization) ToStrings() []string {
@ -30,6 +31,7 @@ func (auth *Authorization) ToStrings() []string {
"u", auth.Uid,
"al", auth.Alias,
"inv", auth.invalidated,
"ct", strconv.FormatInt(auth.CreatedTime, 10),
}
}
@ -39,12 +41,14 @@ func (auth *Authorization) Valid() bool {
func MakeAuthrizationFromStringMap(src map[string]string) Authorization {
accid, _ := primitive.ObjectIDFromHex(src["a"])
ct, _ := strconv.ParseInt(src["ct"], 10, 0)
return Authorization{
Account: accid,
Platform: src["p"],
Uid: src["u"],
Alias: src["al"],
invalidated: src["inv"],
CreatedTime: ct,
}
}