Uh oh!
There was an error while loading. Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork 4
Marketplace Repository#5
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Uh oh!
There was an error while loading. Please reload this page.
Changes from all commits
433705e7d90d42766c7cae831e119b354f070f0399fd6e64691923f98e40f73300e97e19e63ab63f4dc86e5fe1823fb21cf2658380729a90f9f5c2978b6d2cbb1631a67afb966a2be5d0fea5b0b6812e8dfa9c7fFile filter
Filter by extension
Conversations
Uh oh!
There was an error while loading. Please reload this page.
Jump to
Uh oh!
There was an error while loading. Please reload this page.
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,10 @@ | ||
| package dto | ||
| import ( | ||
| "reverse-watch/internal/domain/models" | ||
| ) | ||
| type AdminAuditListOptions struct { | ||
| TargetActions []models.TargetAction | ||
| TargetResource *models.Snowflake | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,24 @@ | ||
| package dto | ||
| import ( | ||
| "reverse-watch/internal/domain/models" | ||
| "reverse-watch/internal/domain/models/constants" | ||
| ) | ||
| // RawKey represents an unhashed API key returned to the consumer upon creation | ||
| type RawKey struct { | ||
| // ID is the key's hash | ||
| ID string `json:"id"` | ||
| Environment constants.Environment `json:"environment"` | ||
| SecretKey string `json:"secret_key"` | ||
| MarketplaceSlug string `json:"marketplace_slug"` | ||
| Permissions models.Permissions `json:"permissions"` | ||
| } | ||
| type KeyUpdateOptions struct { | ||
| Permissions *models.Permissions | ||
| } | ||
| type KeyListOptions struct { | ||
| MarketplaceSlug *string | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,30 @@ | ||
| package dto | ||
| import ( | ||
| "fmt" | ||
| ) | ||
| type MarketplaceUpdateOptions struct { | ||
| Name *string | ||
| IsActive *bool | ||
| } | ||
| func (o *MarketplaceUpdateOptions) ToFields() map[string]interface{} { | ||
| fields := make(map[string]interface{}) | ||
| if o.Name != nil { | ||
| fields["name"] = *o.Name | ||
| } | ||
| if o.IsActive != nil { | ||
| fields["is_active"] = *o.IsActive | ||
| } | ||
| return fields | ||
| } | ||
| func (o *MarketplaceUpdateOptions) Validate() error { | ||
| if o.Name != nil { | ||
| if len(*o.Name) <= 0 || len(*o.Name) > 50 { | ||
| return fmt.Errorf("name must be between 1 and 50 characters long") | ||
| } | ||
| } | ||
| return nil | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,56 @@ | ||
| package dto | ||
zedimytch marked this conversation as resolved.
Uh oh!There was an error while loading. Please reload this page. | ||
| import ( | ||
| "reflect" | ||
| "testing" | ||
| "reverse-watch/internal/domain/models" | ||
| ) | ||
| func TestMarketplaceUpdateOptions_FieldCoverage(t *testing.T) { | ||
| t.Parallel() | ||
| optsType := reflect.TypeOf((*MarketplaceUpdateOptions)(nil)).Elem() | ||
| marketplaceType := reflect.TypeOf((*models.Marketplace)(nil)).Elem() | ||
| excludedFieldNames := []string{ | ||
| "CreatedAt", | ||
| "UpdatedAt", | ||
| } | ||
| marketplaceFields := make(map[string]reflect.StructField) | ||
| for i := 0; i < marketplaceType.NumField(); i++ { | ||
| field := marketplaceType.Field(i) | ||
| marketplaceFields[field.Name] = field | ||
| } | ||
| for i := 0; i < optsType.NumField(); i++ { | ||
| optsField := optsType.Field(i) | ||
| excluded := false | ||
| for _, excludedFieldName := range excludedFieldNames { | ||
| if optsField.Name == excludedFieldName { | ||
| excluded = true | ||
| break | ||
| } | ||
| } | ||
| if excluded { | ||
| continue | ||
| } | ||
| marketplaceField, ok := marketplaceFields[optsField.Name] | ||
| if !ok { | ||
| t.Errorf("MarketplaceUpdateOptions contains non-existent Marketplace field: %s", optsField.Name) | ||
| continue | ||
| } | ||
cursor[bot] marked this conversation as resolved.
Uh oh!There was an error while loading. Please reload this page. | ||
| if optsField.Type.Kind() != reflect.Ptr { | ||
| t.Errorf("MarketplaceUpdateOptions contains non-pointer field: %s", optsField.Name) | ||
| } | ||
| // Ensure same type | ||
| if optsField.Type.Kind() == reflect.Ptr && marketplaceField.Type != optsField.Type.Elem() { | ||
| t.Errorf("MarketplaceUpdateOptions contains field %q with incorrect type", optsField.Name) | ||
| } | ||
| } | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,12 @@ | ||
| package dto | ||
| import ( | ||
| "reverse-watch/internal/domain/models" | ||
| ) | ||
| type ReversalListOptions struct { | ||
| SteamID *models.SteamID | ||
| MarketplaceSlug *string | ||
| Cursor *Cursor | ||
| Limit *uint | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,8 @@ | ||
| package constants | ||
| type Environment string | ||
| const ( | ||
| EnvironmentDevelopment Environment = "development" | ||
| EnvironmentProduction Environment = "production" | ||
| ) |
This file was deleted.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.