KLO-268 : API: IOT-console microservices#307
Conversation
There was a problem hiding this comment.
Hey @nxtcoder19 - I've reviewed your changes and they look great!
Here's what I looked at during the review
- 🟡 General issues: 8 issues found
- 🟡 Security: 1 issue found
- 🟢 Testing: all looks good
- 🟢 Complexity: all looks good
- 🟢 Docstrings: all looks good
Help me be more useful! Please click 👍 or 👎 on each comment to tell me if it was helpful.
| ) | ||
|
|
||
| // CreationTime is the resolver for the creationTime field. | ||
| func (r *iOTAppResolver) CreationTime(ctx context.Context, obj *entities.IOTApp) (string, error) { |
There was a problem hiding this comment.
nitpick (code_refinement): Consider using a more descriptive variable name than 'r'.
| ) | ||
|
|
||
| // BluePrintType is the resolver for the bluePrintType field. | ||
| func (r *iOTDeviceBlueprintResolver) BluePrintType(ctx context.Context, obj *entities.IOTDeviceBlueprint) (model.GithubComKloudliteAPIAppsIotConsoleInternalEntitiesBluePrintType, error) { |
There was a problem hiding this comment.
nitpick (code_refinement): Consider using a more descriptive variable name than 'r'.
| ) | ||
|
|
||
| // UserID is the resolver for the userId field. | ||
| func (r *github__com___kloudlite___api___common__CreatedOrUpdatedByResolver) UserID(ctx context.Context, obj *common.CreatedOrUpdatedBy) (string, error) { |
There was a problem hiding this comment.
nitpick (code_refinement): Consider using a more descriptive variable name than 'r'.
| ) | ||
|
|
||
| // CreationTime is the resolver for the creationTime field. | ||
| func (r *iOTDeploymentResolver) CreationTime(ctx context.Context, obj *entities.IOTDeployment) (string, error) { |
There was a problem hiding this comment.
nitpick (code_refinement): Consider using a more descriptive variable name than 'r'.
| type BluePrintType string | ||
|
|
||
| const ( | ||
| SingletonBlueprint BluePrintType = "singleton_blueprint" | ||
| GroupBlueprint BluePrintType = "group_blueprint" | ||
| ) | ||
|
|
||
| type IOTDeviceBlueprint struct { |
There was a problem hiding this comment.
suggestion (code_clarification): Consider adding documentation for public types and constants.
| type BluePrintType string | |
| const ( | |
| SingletonBlueprint BluePrintType = "singleton_blueprint" | |
| GroupBlueprint BluePrintType = "group_blueprint" | |
| ) | |
| type IOTDeviceBlueprint struct { | |
| // BluePrintType defines the type of IoT device blueprint. | |
| type BluePrintType string | |
| const ( | |
| // SingletonBlueprint represents a blueprint for a single IoT device. | |
| SingletonBlueprint BluePrintType = "singleton_blueprint" | |
| // GroupBlueprint represents a blueprint for a group of IoT devices. | |
| GroupBlueprint BluePrintType = "group_blueprint" | |
| ) |
| type Env struct { | ||
| Port uint16 `env:"HTTP_PORT" required:"true"` | ||
|
|
||
| IotDeviceDBUri string `env:"MONGO_URI" required:"true"` | ||
| IotDeviceDBName string `env:"MONGO_DB_NAME" required:"true"` | ||
|
|
||
| AccountCookieName string `env:"ACCOUNT_COOKIE_NAME" required:"true"` | ||
| ClusterCookieName string `env:"CLUSTER_COOKIE_NAME" required:"true"` | ||
|
|
||
| // NATS:start | ||
| NatsURL string `env:"NATS_URL" required:"true"` | ||
| NatsResourceSyncStream string `env:"NATS_RESOURCE_STREAM" required:"true"` | ||
| // NATS:end | ||
|
|
||
| DefaultProjectWorkspaceName string `env:"DEFAULT_PROJECT_WORKSPACE_NAME" required:"true"` | ||
|
|
||
| PromHttpAddr string `env:"PROM_HTTP_ADDR" required:"true"` | ||
| IsDev bool | ||
| KubernetesApiProxy string `env:"KUBERNETES_API_PROXY"` | ||
|
|
||
| SessionKVBucket string `env:"SESSION_KV_BUCKET" required:"true"` | ||
| ConsoleCacheKVBucket string `env:"CONSOLE_CACHE_KV_BUCKET" required:"true"` | ||
|
|
||
| DeviceNamespace string `env:"DEVICE_NAMESPACE" required:"true"` | ||
| } |
There was a problem hiding this comment.
suggestion (code_refinement): Validate environment variable values for expected formats and ranges.
| type IOTDeployment struct { | ||
| repos.BaseEntity `json:",inline" graphql:"noinput"` | ||
| Name string `json:"name"` | ||
| AccountName string `json:"accountName" graphql:"noinput"` | ||
| ProjectName string `json:"projectName" graphql:"noinput"` | ||
| EnvironmentName string `json:"environmentName" graphql:"noinput"` | ||
| CIDR string `json:"CIDR"` | ||
| ExposedServices []ExposedService `json:"exposedServices"` | ||
|
|
||
| common.ResourceMetadata `json:",inline"` | ||
| } |
There was a problem hiding this comment.
suggestion (code_refinement): Consider adding validation for 'CIDR' format.
| func (ec *executionContext) __resolve__service(ctx context.Context) (fedruntime.Service, error) { | ||
| if ec.DisableIntrospection { | ||
| return fedruntime.Service{}, errors.New("federated introspection disabled") | ||
| } | ||
|
|
||
| var sdl []string | ||
|
|
||
| for _, src := range sources { | ||
| if src.BuiltIn { | ||
| continue | ||
| } | ||
| sdl = append(sdl, src.Input) | ||
| } | ||
|
|
||
| return fedruntime.Service{ | ||
| SDL: strings.Join(sdl, "\n"), | ||
| }, nil | ||
| } |
There was a problem hiding this comment.
🚨 suggestion (security): Review the necessity of disabling federated introspection in production.
… services - iot project - iot environment - iot deployment - iot device blueprint - iot device - iot app Generate graphql schema for gateway og iot-console
d6deee7 to
bd23bc7
Compare
KLO-268 : API: IOT-console microservices
Resolves kloudlite/kloudlite#89