mirror of
https://github.com/infiniflow/ragflow.git
synced 2026-09-08 10:14:35 +08:00
Update go cli (#13717)
### What problem does this PR solve? Go cli ### Type of change - [x] New Feature (non-breaking change which adds functionality) --------- Signed-off-by: Jin Hai <haijin.chn@gmail.com>
This commit is contained in:
@@ -46,6 +46,16 @@ func (dao *APITokenDAO) DeleteByTenantID(tenantID string) (int64, error) {
|
||||
return result.RowsAffected, result.Error
|
||||
}
|
||||
|
||||
// GetByToken gets API token by access key
|
||||
func (dao *APITokenDAO) GetUserByAPIToken(token string) (*model.APIToken, error) {
|
||||
var apiToken model.APIToken
|
||||
err := DB.Where("token = ?", token).First(&apiToken).Error
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &apiToken, nil
|
||||
}
|
||||
|
||||
// DeleteByDialogIDs deletes API tokens by dialog IDs (hard delete)
|
||||
func (dao *APITokenDAO) DeleteByDialogIDs(dialogIDs []string) (int64, error) {
|
||||
if len(dialogIDs) == 0 {
|
||||
@@ -55,6 +65,12 @@ func (dao *APITokenDAO) DeleteByDialogIDs(dialogIDs []string) (int64, error) {
|
||||
return result.RowsAffected, result.Error
|
||||
}
|
||||
|
||||
// DeleteByTenantIDAndToken deletes a specific API token by tenant ID and token value
|
||||
func (dao *APITokenDAO) DeleteByTenantIDAndToken(tenantID, token string) (int64, error) {
|
||||
result := DB.Unscoped().Where("tenant_id = ? AND token = ?", tenantID, token).Delete(&model.APIToken{})
|
||||
return result.RowsAffected, result.Error
|
||||
}
|
||||
|
||||
// API4ConversationDAO API for conversation data access object
|
||||
type API4ConversationDAO struct{}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user