(ctx context.Context, eid, userID int64, name, description string)
| 17 | } |
| 18 | |
| 19 | func (s *APIKeyService) CreateOwnedAPIKey(ctx context.Context, eid, userID int64, name, description string) (*model.APIKey, string, error) { |
| 20 | keyValue := model.GenerateAPIKey(eid, userID) |
| 21 | apiKey := &model.APIKey{ |
| 22 | Key: keyValue, |
| 23 | Name: name, |
| 24 | Description: description, |
| 25 | Eid: eid, |
| 26 | CreatorID: userID, |
| 27 | Status: model.APIKeyStatusActive, |
| 28 | } |
| 29 | if err := apiKey.Save(); err != nil { |
| 30 | return nil, "", err |
| 31 | } |
| 32 | return apiKey, keyValue, nil |
| 33 | } |
| 34 | |
| 35 | func (s *APIKeyService) ListOwnedAPIKeys(ctx context.Context, eid, userID int64) ([]model.APIKey, error) { |
| 36 | return model.GetAPIKeysByEidAndCreatorID(eid, userID) |
no test coverage detected