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