Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 0 additions & 3 deletions console/public/locales/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -231,9 +231,6 @@
"details": "Provider Details",
"config": "Configuration",
"name": "Name",
"rate_limit": "Rate Limit",
"rate_limit_description": "Maximum number of requests per interval",
"rate_interval": "Rate Interval",
"back": "Back to providers",
"create": "Create Provider",
"update": "Update Provider",
Expand Down
13 changes: 0 additions & 13 deletions console/src/oapi/management.generated.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,17 @@
export interface paths {
"/api/auth/methods": {
parameters: {
query?: never;

Check warning on line 9 in console/src/oapi/management.generated.ts

View workflow job for this annotation

GitHub Actions / lint

Delete `;`
header?: never;

Check warning on line 10 in console/src/oapi/management.generated.ts

View workflow job for this annotation

GitHub Actions / lint

Delete `;`
path?: never;

Check warning on line 11 in console/src/oapi/management.generated.ts

View workflow job for this annotation

GitHub Actions / lint

Delete `;`
cookie?: never;

Check warning on line 12 in console/src/oapi/management.generated.ts

View workflow job for this annotation

GitHub Actions / lint

Delete `;`
};

Check warning on line 13 in console/src/oapi/management.generated.ts

View workflow job for this annotation

GitHub Actions / lint

Delete `;`
/**
* Get available auth methods
* @description Returns a list of available authentication methods/drivers
*/
get: operations["getAuthMethods"];

Check warning on line 18 in console/src/oapi/management.generated.ts

View workflow job for this annotation

GitHub Actions / lint

Delete `;`
put?: never;

Check warning on line 19 in console/src/oapi/management.generated.ts

View workflow job for this annotation

GitHub Actions / lint

Delete `;`
post?: never;
delete?: never;
options?: never;
Expand Down Expand Up @@ -2253,13 +2253,6 @@
data?: components["schemas"]["EmailProviderData"] | components["schemas"]["SmsProviderData"] | components["schemas"]["PushProviderData"];
/** @example true */
is_default: boolean;
/** @example 0 */
rate_limit?: number;
/**
* @example second
* @enum {string}
*/
rate_interval?: "second" | "minute" | "hour" | "day";
/**
* Format: date-time
* @example 2025-11-05T13:38:03.861Z
Expand All @@ -2279,9 +2272,6 @@
};
/** @example false */
is_default?: boolean;
rate_limit?: number;
/** @enum {string} */
rate_interval?: "second" | "minute" | "hour" | "day";
};
UpdateProvider: {
/** @example My Email Provider */
Expand All @@ -2290,9 +2280,6 @@
[key: string]: unknown;
};
is_default?: boolean;
rate_limit?: number;
/** @enum {string} */
rate_interval?: "second" | "minute" | "hour" | "day";
};
ProviderMeta: {
/**
Expand Down
4 changes: 1 addition & 3 deletions console/src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -727,15 +727,13 @@ export interface Provider {

data: any
is_default: boolean
rate_limit: number
rate_interval: string
setup: ProviderSetupMeta[]
external_id?: string
}

export type ProviderCreateParams = Pick<
Provider,
"name" | "data" | "module" | "channel" | "rate_limit" | "rate_interval"
"name" | "data" | "module" | "channel"
>
export type ProviderUpdateParams = ProviderCreateParams
export interface ProviderMeta {
Expand Down
52 changes: 12 additions & 40 deletions console/src/views/settings/IntegrationModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import { ProjectContext } from "../../contexts"
import { useResolver } from "../../hooks"
import { snakeToTitle } from "../../utils"
import type { Project, Provider, ProviderCreateParams, ProviderMeta } from "../../types"
import type { SchemaProperty } from "@/components/SchemaFields"

import { Button } from "@/components/ui/button"
import { Input } from "@/components/ui/input"
Expand All @@ -19,13 +20,6 @@ import {
DialogHeader,
DialogTitle,
} from "@/components/ui/dialog"
import {
Select,
SelectContent,
SelectItem,
SelectTrigger,
SelectValue,
} from "@/components/ui/select"
import { Separator } from "@/components/ui/separator"
import { SchemaFields } from "@/components/SchemaFields"
interface IntegrationFormParams {
Expand Down Expand Up @@ -67,12 +61,10 @@ export function IntegrationForm({
? {
name: provider.name,
data: provider.data,
rate_limit: provider.rate_limit,
rate_interval: provider.rate_interval,
module,
channel,
}
: { name: "", data: {}, rate_limit: 0, rate_interval: "second", module, channel },
: { name: "", data: {}, module, channel },
})

const handleSubmit = async (values: ProviderCreateParams) => {
Expand Down Expand Up @@ -123,36 +115,16 @@ export function IntegrationForm({
<Input {...form.register("name", { required: true })} />
</div>

<SchemaFields parent="data" schema={meta.schema.properties.data} form={form} />

<div className="grid gap-2">
<Label>{t("rate_limit")}</Label>
<p className="text-sm text-muted-foreground">
{t(
"rate_limit_hint",
"If you need to cap send rate, enter the maximum per interval limit.",
)}
</p>
<Input type="number" {...form.register("rate_limit", { valueAsNumber: true })} />
</div>

<div className="grid gap-2">
<Label>{t("rate_interval")}</Label>
<Select
value={form.watch("rate_interval") ?? "second"}
onValueChange={(val) => form.setValue("rate_interval", val)}
>
<SelectTrigger>
<SelectValue />
</SelectTrigger>
<SelectContent>
<SelectItem value="second">{t("second")}</SelectItem>
<SelectItem value="minute">{t("minute")}</SelectItem>
<SelectItem value="hour">{t("hour")}</SelectItem>
<SelectItem value="day">{t("day")}</SelectItem>
</SelectContent>
</Select>
</div>
<SchemaFields
parent="data"
schema={
Array.isArray(meta.schema.properties)
? meta.schema.properties.find((p: SchemaProperty) => p.name === "data")
?.schema
: meta.schema.properties?.data
}
form={form}
/>

<DialogFooter className="pt-2">
<Button type="submit" disabled={isSaving}>
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ require (
go.opentelemetry.io/otel v1.38.0
go.uber.org/zap v1.27.0
golang.org/x/sync v0.18.0
golang.org/x/text v0.30.0
)

require (
Expand Down Expand Up @@ -309,7 +310,6 @@ require (
golang.org/x/exp/typeparams v0.0.0-20250210185358-939b2ce775ac // indirect
golang.org/x/mod v0.28.0 // indirect
golang.org/x/sys v0.38.0 // indirect
golang.org/x/text v0.30.0 // indirect
golang.org/x/time v0.12.0 // indirect
golang.org/x/tools v0.37.0 // indirect
golang.org/x/tools/go/expect v0.1.1-deprecated // indirect
Expand Down
20 changes: 0 additions & 20 deletions internal/http/controllers/v1/management/oapi/resources.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4942,14 +4942,6 @@ components:
is_default:
type: boolean
example: true
rate_limit:
type: integer
example: 0
x-go-type: int32
rate_interval:
type: string
enum: [second, minute, hour, day]
example: "second"
created_at:
type: string
format: date-time
Expand All @@ -4974,12 +4966,6 @@ components:
is_default:
type: boolean
example: false
rate_limit:
type: integer
x-go-type: int32
rate_interval:
type: string
enum: [second, minute, hour, day]

UpdateProvider:
type: object
Expand All @@ -4993,12 +4979,6 @@ components:
x-go-type: json.RawMessage
is_default:
type: boolean
rate_limit:
type: integer
x-go-type: int32
rate_interval:
type: string
enum: [second, minute, hour, day]

ProviderMeta:
type: object
Expand Down
71 changes: 16 additions & 55 deletions internal/http/controllers/v1/management/oapi/resources_gen.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

15 changes: 0 additions & 15 deletions internal/http/controllers/v1/management/providers.go
Original file line number Diff line number Diff line change
Expand Up @@ -155,15 +155,6 @@ func (srv *ProvidersController) CreateProvider(w http.ResponseWriter, r *http.Re
provider.IsDefault = *body.IsDefault
}

if body.RateLimit != nil {
provider.RateLimit = body.RateLimit
}

if body.RateInterval != nil {
interval := string(*body.RateInterval)
provider.RateInterval = &interval
}

providerID, err := srv.store.ProvidersStore.CreateProvider(ctx, provider)
if err != nil {
logger.Error("failed to create provider", zap.Error(err))
Expand Down Expand Up @@ -238,12 +229,6 @@ func (srv *ProvidersController) UpdateProvider(w http.ResponseWriter, r *http.Re
Name: body.Name,
Data: body.Data,
IsDefault: body.IsDefault,
RateLimit: body.RateLimit,
}

if body.RateInterval != nil {
interval := string(*body.RateInterval)
update.RateInterval = &interval
}

err = srv.store.ProvidersStore.UpdateProvider(ctx, projectID, providerID, update)
Expand Down
2 changes: 1 addition & 1 deletion internal/store/management/organizations.go
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ func (s *OrganizationsStore) DeleteOrganization(ctx context.Context, id uuid.UUI
func (s *OrganizationsStore) GetOrganizationIntegrations(ctx context.Context, orgID uuid.UUID) (Providers, error) {
stmt := `
SELECT p.id, p.project_id, p.module, p.channel, p.data, p.is_default,
p.rate_limit, p.rate_interval, p.name, p.created_at, p.updated_at
p.name, p.created_at, p.updated_at
FROM providers p
INNER JOIN projects pr ON pr.id = p.project_id
WHERE pr.organization_id = $1
Expand Down
Loading
Loading