생성일시 전달하는 코드 추가
This commit is contained in:
@ -24,12 +24,14 @@ type Authorization struct {
|
||||
}
|
||||
|
||||
func (auth *Authorization) ToStrings() []string {
|
||||
ct, _ := auth.CreatedTime.MarshalJSON()
|
||||
return []string{
|
||||
"a", auth.Account.Hex(),
|
||||
"p", auth.Platform,
|
||||
"u", auth.Uid,
|
||||
"al", auth.Alias,
|
||||
"inv", auth.invalidated,
|
||||
"ct", string(ct),
|
||||
}
|
||||
}
|
||||
|
||||
@ -39,12 +41,15 @@ func (auth *Authorization) Valid() bool {
|
||||
|
||||
func MakeAuthrizationFromStringMap(src map[string]string) Authorization {
|
||||
accid, _ := primitive.ObjectIDFromHex(src["a"])
|
||||
var datetime primitive.DateTime
|
||||
datetime.UnmarshalJSON([]byte(src["ct"]))
|
||||
return Authorization{
|
||||
Account: accid,
|
||||
Platform: src["p"],
|
||||
Uid: src["u"],
|
||||
Alias: src["al"],
|
||||
invalidated: src["inv"],
|
||||
CreatedTime: datetime,
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user