Skip to content
This repository was archived by the owner on Jun 11, 2025. It is now read-only.

KLO-268 : API: IOT-console microservices#307

Merged
nxtcoder17 merged 2 commits into
mainfrom
services/iot-console
Apr 9, 2024
Merged

KLO-268 : API: IOT-console microservices#307
nxtcoder17 merged 2 commits into
mainfrom
services/iot-console

Conversation

@nxtcoder19
Copy link
Copy Markdown
Contributor

Copy link
Copy Markdown

@sourcery-ai sourcery-ai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
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) {
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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) {
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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) {
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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) {
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nitpick (code_refinement): Consider using a more descriptive variable name than 'r'.

Comment on lines +9 to +16
type BluePrintType string

const (
SingletonBlueprint BluePrintType = "singleton_blueprint"
GroupBlueprint BluePrintType = "group_blueprint"
)

type IOTDeviceBlueprint struct {
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

suggestion (code_clarification): Consider adding documentation for public types and constants.

Suggested change
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"
)

Comment on lines +8 to +32
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"`
}
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

suggestion (code_refinement): Validate environment variable values for expected formats and ranges.

Comment on lines +9 to +19
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"`
}
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

suggestion (code_refinement): Consider adding validation for 'CIDR' format.

Comment on lines +18 to +35
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
}
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🚨 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
@nxtcoder19 nxtcoder19 force-pushed the services/iot-console branch from d6deee7 to bd23bc7 Compare April 4, 2024 06:19
@kloudlite kloudlite deleted a comment from sourcery-ai Bot Apr 9, 2024
@nxtcoder17 nxtcoder17 merged commit 17857bd into main Apr 9, 2024
@nxtcoder17 nxtcoder17 deleted the services/iot-console branch April 9, 2024 06:23
abdheshnayak pushed a commit that referenced this pull request Nov 5, 2024
KLO-268 : API: IOT-console microservices
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[KLO-268] API: IOT-console microservices api

2 participants