MSP-8394 Simplify AuthDataByToken sql query
This commit is contained in:
1 parent
64d2c71ca2
commit
f70a210b35
2 files changed
+5
-8
No files matched your search
+4
-5
@@ -12,9 +12,8 @@ type Token struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
type AuthData struct {
|
type AuthData struct {
|
||||||
AppName string
|
AppName string
|
||||||
ApplicationGroupId int
|
AppId int
|
||||||
AppId int
|
ExpireTime int
|
||||||
ExpireTime int
|
CreatedAt time.Time
|
||||||
CreatedAt time.Time
|
|
||||||
}
|
}
|
||||||
+1
-3
@@ -112,12 +112,10 @@ func (r Token) AuthDataByToken(ctx context.Context, token string) (*entity.AuthD
|
|||||||
ctx = sql_metrics.OperationLabelToContext(ctx, "Token.AuthDataByToken")
|
ctx = sql_metrics.OperationLabelToContext(ctx, "Token.AuthDataByToken")
|
||||||
|
|
||||||
q := `
|
q := `
|
||||||
SELECT application_group_id, app_id, application.name AS app_name , token.expire_time, token.created_at
|
SELECT app_id, application.name AS app_name , token.expire_time, token.created_at
|
||||||
FROM token
|
FROM token
|
||||||
LEFT JOIN application
|
LEFT JOIN application
|
||||||
ON token.app_id = application.id
|
ON token.app_id = application.id
|
||||||
LEFT JOIN application_group
|
|
||||||
ON application.application_group_id = application_group.id
|
|
||||||
WHERE token = $1
|
WHERE token = $1
|
||||||
`
|
`
|
||||||
result := entity.AuthData{}
|
result := entity.AuthData{}
|
||||||
|
|||||||
Reference in new issue
Block a user