SigNoz is an open-source, OpenTelemetry-native observability platform for your team and their AI agents. Get logs, metrics, and traces in one tool with features like APM, distributed tracing, log management, infra monitoring, etc. Combined with SigNoz MCP and a native AI teammate (in SigNoz Cloud) it helps you build more resilient apps.
TypeScript apmapplication-monitoringdistributed-tracinggogood-first-issuejaegerloglogsmetricsmonitoringnextjsobservabilityopen-sourceopentelemetryprometheusreactreactjsself-hostedtracingtypescript
chore(user): remove the deprecated bulk invite endpoint (#12473)
Vikrant Guptab904aca1a8c9
diff --git a/docs/api/openapi.yml b/docs/api/openapi.ymlindex 8ce1533c32..0a4da46c32 100644--- a/docs/api/openapi.yml+++ b/docs/api/openapi.yml@@ -8938,15 +8938,6 @@ components:required:- idtype: object- TypesPostableBulkInviteRequest:- properties:- invites:- items:- $ref: '#/components/schemas/TypesPostableInvite'- type: array- required:- - invites- type: objectTypesPostableForgotPassword:properties:email:@@ -11554,57 +11545,6 @@ paths:summary: Create invitetags:- users- /api/v1/invite/bulk:- post:- deprecated: true- description: This endpoint creates a bulk invite for a user- operationId: CreateBulkInvite- requestBody:- content:- application/json:- schema:- $ref: '#/components/schemas/TypesPostableBulkInviteRequest'- responses:- "201":- description: Created- "400":- content:- application/json:- schema:- $ref: '#/components/schemas/RenderErrorResponse'- description: Bad Request- "401":- content:- application/json:- schema:- $ref: '#/components/schemas/RenderErrorResponse'- description: Unauthorized- "403":- content:- application/json:- schema:- $ref: '#/components/schemas/RenderErrorResponse'- description: Forbidden- "409":- content:- application/json:- schema:- $ref: '#/components/schemas/RenderErrorResponse'- description: Conflict- "500":- content:- application/json:- schema:- $ref: '#/components/schemas/RenderErrorResponse'- description: Internal Server Error- security:- - api_key:- - ADMIN- - tokenizer:- - ADMIN- summary: Create bulk invite- tags:- - users/api/v1/llm_pricing_rules:get:deprecated: falsediff --git a/frontend/src/api/generated/services/sigNoz.schemas.ts b/frontend/src/api/generated/services/sigNoz.schemas.tsindex da04376e50..25b893f0ab 100644--- a/frontend/src/api/generated/services/sigNoz.schemas.ts+++ b/frontend/src/api/generated/services/sigNoz.schemas.ts@@ -10057,45 +10057,38 @@ export interface TypesOrganizationDTO {updatedAt?: string;}-export interface TypesPostableInviteDTO {- /**- * @type string- */- email?: string;+export interface TypesPostableForgotPasswordDTO {/*** @type string*/- frontendBaseUrl?: string;+ email: string;/*** @type string*/- name?: string;+ frontendBaseURL?: string;/*** @type string*/- role?: string;+ orgId: string;}-export interface TypesPostableBulkInviteRequestDTO {+export interface TypesPostableInviteDTO {/**- * @type array+ * @type string*/- invites: TypesPostableInviteDTO[];-}--export interface TypesPostableForgotPasswordDTO {+ email?: string;/*** @type string*/- email: string;+ frontendBaseUrl?: string;/*** @type string*/- frontendBaseURL?: string;+ name?: string;/*** @type string*/- orgId: string;+ role?: string;}export interface TypesPostableResetPasswordDTO {diff --git a/frontend/src/api/generated/services/users/index.ts b/frontend/src/api/generated/services/users/index.tsindex e1b90f3fa3..9b395e6a3c 100644--- a/frontend/src/api/generated/services/users/index.ts+++ b/frontend/src/api/generated/services/users/index.ts@@ -51,7 +51,6 @@ import type {SetRoleByUserIDPathParameters,TypesChangePasswordRequestDTO,TypesDeprecatedUserDTO,- TypesPostableBulkInviteRequestDTO,TypesPostableForgotPasswordDTO,TypesPostableInviteDTO,TypesPostableResetPasswordDTO,@@ -260,91 +259,6 @@ export const useCreateInvite = <> => {return useMutation(getCreateInviteMutationOptions(options));};-/**- * This endpoint creates a bulk invite for a user- * @deprecated- * @summary Create bulk invite- */-export const createBulkInvite = (- typesPostableBulkInviteRequestDTO?: BodyType<TypesPostableBulkInviteRequestDTO>,- signal?: AbortSignal,-) => {- return GeneratedAPIInstance<void>({- url: `/api/v1/invite/bulk`,- method: 'POST',- headers: { 'Content-Type': 'application/json' },- data: typesPostableBulkInviteRequestDTO,- signal,- });-};--export const getCreateBulkInviteMutationOptions = <- TError = ErrorType<RenderErrorResponseDTO>,- TContext = unknown,->(options?: {- mutation?: UseMutationOptions<- Awaited<ReturnType<typeof createBulkInvite>>,- TError,- { data?: BodyType<TypesPostableBulkInviteRequestDTO> },- TContext- >;-}): UseMutationOptions<- Awaited<ReturnType<typeof createBulkInvite>>,- TError,- { data?: BodyType<TypesPostableBulkInviteRequestDTO> },- TContext-> => {- const mutationKey = ['createBulkInvite'];- const { mutation: mutationOptions } = options- ? options.mutation &&- 'mutationKey' in options.mutation &&- options.mutation.mutationKey- ? options- : { ...options, mutation: { ...options.mutation, mutationKey } }- : { mutation: { mutationKey } };-- const mutationFn: MutationFunction<- Awaited<ReturnType<typeof createBulkInvite>>,- { data?: BodyType<TypesPostableBulkInviteRequestDTO> }- > = (props) => {- const { data } = props ?? {};-- return createBulkInvite(data);- };-- return { mutationFn, ...mutationOptions };-};--export type CreateBulkInviteMutationResult = NonNullable<- Awaited<ReturnType<typeof createBulkInvite>>->;-export type CreateBulkInviteMutationBody =- | BodyType<TypesPostableBulkInviteRequestDTO>- | undefined;-export type CreateBulkInviteMutationError = ErrorType<RenderErrorResponseDTO>;--/**- * @deprecated- * @summary Create bulk invite- */-export const useCreateBulkInvite = <- TError = ErrorType<RenderErrorResponseDTO>,- TContext = unknown,->(options?: {- mutation?: UseMutationOptions<- Awaited<ReturnType<typeof createBulkInvite>>,- TError,- { data?: BodyType<TypesPostableBulkInviteRequestDTO> },- TContext- >;-}): UseMutationResult<- Awaited<ReturnType<typeof createBulkInvite>>,- TError,- { data?: BodyType<TypesPostableBulkInviteRequestDTO> },- TContext-> => {- return useMutation(getCreateBulkInviteMutationOptions(options));-};/*** This endpoint resets the password by token* @summary Reset passworddiff --git a/frontend/src/api/v1/invite/bulk/create.ts b/frontend/src/api/v1/invite/bulk/create.tsdeleted file mode 100644index 78bd7679fb..0000000000--- a/frontend/src/api/v1/invite/bulk/create.ts+++ /dev/null@@ -1,28 +0,0 @@-import axios from 'api';-import { ErrorResponseHandlerV2 } from 'api/ErrorResponseHandlerV2';-import { AxiosError } from 'axios';-import { ErrorV2Resp, SuccessResponseV2 } from 'types/api';-import { UsersProps } from 'types/api/user/inviteUsers';--/**- * @deprecated Use the generated `useCreateBulkInvite` hook (or `createBulkInvite` fetcher) from- * `api/generated/services/users` instead. This hand-written client targets the- * same endpoint and will be removed once call sites migrate.- *- * Part of https://github.com/SigNoz/engineering-pod/issues/5289, add a comment or update when removing this method.- */-const inviteUsers = async (- users: UsersProps,-): Promise<SuccessResponseV2<null>> => {- try {- const response = await axios.post(`/invite/bulk`, users);- return {- httpStatusCode: response.status,- data: null,- };- } catch (error) {- ErrorResponseHandlerV2(error as AxiosError<ErrorV2Resp>);- }-};--export default inviteUsers;diff --git a/frontend/src/types/api/user/inviteUsers.ts b/frontend/src/types/api/user/inviteUsers.tsdeleted file mode 100644index 7bd56707f2..0000000000--- a/frontend/src/types/api/user/inviteUsers.ts+++ /dev/null@@ -1,12 +0,0 @@-import { User } from 'types/reducer/app';--export interface UserProps {- name: User['displayName'];- email: User['email'];- role: string;- frontendBaseUrl: string;-}--export interface UsersProps {- invites: UserProps[];-}diff --git a/pkg/apiserver/signozapiserver/user.go b/pkg/apiserver/signozapiserver/user.goindex cc222128b4..0cd719e35c 100644--- a/pkg/apiserver/signozapiserver/user.go+++ b/pkg/apiserver/signozapiserver/user.go@@ -27,22 +27,6 @@ func (provider *provider) addUserRoutes(router *mux.Router) error {return err}- if err := router.Handle("/api/v1/invite/bulk", handler.New(provider.authzMiddleware.AdminAccess(provider.userHandler.CreateBulkInvite), handler.OpenAPIDef{- ID: "CreateBulkInvite",- Tags: []string{"users"},- Summary: "Create bulk invite",- Description: "This endpoint creates a bulk invite for a user",- Request: new(types.PostableBulkInviteRequest),- RequestContentType: "application/json",- Response: nil,- SuccessStatusCode: http.StatusCreated,- ErrorStatusCodes: []int{http.StatusBadRequest, http.StatusConflict},- Deprecated: true,- SecuritySchemes: newSecuritySchemes(types.RoleAdmin),- })).Methods(http.MethodPost).GetError(); err != nil {- return err- }-if err := router.Handle("/api/v1/user", handler.New(provider.authzMiddleware.AdminAccess(provider.userHandler.ListUsersDeprecated), handler.OpenAPIDef{ID: "ListUsersDeprecated",Tags: []string{"users"},diff --git a/pkg/modules/user/impluser/handler.go b/pkg/modules/user/impluser/handler.goindex 77900cbbd9..1c1453b5cc 100644--- a/pkg/modules/user/impluser/handler.go+++ b/pkg/modules/user/impluser/handler.go@@ -88,37 +88,6 @@ func (handler *handler) CreateInvite(rw http.ResponseWriter, r *http.Request) {render.Success(rw, http.StatusCreated, invites[0])}-func (handler *handler) CreateBulkInvite(rw http.ResponseWriter, r *http.Request) {- ctx, cancel := context.WithTimeout(r.Context(), 10*time.Second)- defer cancel()-- claims, err := authtypes.ClaimsFromContext(ctx)- if err != nil {- render.Error(rw, err)- return- }-- var req types.PostableBulkInviteRequest- if err := json.NewDecoder(r.Body).Decode(&req); err != nil {- render.Error(rw, err)- return- }-- // Validate that the request contains users- if len(req.Invites) == 0 {- render.Error(rw, errors.New(errors.TypeInvalidInput, errors.CodeInvalidInput, "no invites provided for invitation"))- return- }-- _, err = handler.setter.CreateBulkInvite(ctx, valuer.MustNewUUID(claims.OrgID), valuer.MustNewUUID(claims.IdentityID()), valuer.MustNewEmail(claims.Email), &req)- if err != nil {- render.Error(rw, err)- return- }-- render.Success(rw, http.StatusCreated, nil)-}-func (handler *handler) GetUserDeprecated(w http.ResponseWriter, r *http.Request) {ctx, cancel := context.WithTimeout(r.Context(), 10*time.Second)defer cancel()diff --git a/pkg/modules/user/user.go b/pkg/modules/user/user.goindex cd1339b5d1..9285ade464 100644--- a/pkg/modules/user/user.go+++ b/pkg/modules/user/user.go@@ -109,7 +109,6 @@ type Getter interface {type Handler interface {// inviteCreateInvite(http.ResponseWriter, *http.Request)- CreateBulkInvite(http.ResponseWriter, *http.Request)// usersListUsersDeprecated(http.ResponseWriter, *http.Request)diff --git a/tests/integration/tests/passwordauthn/06_invite_status.py b/tests/integration/tests/passwordauthn/06_invite_status.pyindex c9f08dee8a..6da9bc8b64 100644--- a/tests/integration/tests/passwordauthn/06_invite_status.py+++ b/tests/integration/tests/passwordauthn/06_invite_status.py@@ -90,37 +90,6 @@ def test_reinvite_deleted_user(assert user_token is not None-def test_bulk_invite(- signoz: SigNoz,- get_token: Callable[[str, str], str],-):- """- Verify the bulk invite endpoint creates multiple pending_invite users.- """- admin_token = get_token(USER_ADMIN_EMAIL, USER_ADMIN_PASSWORD)-- response = requests.post(- signoz.self.host_configs["8080"].get("/api/v1/invite/bulk"),- json={- "invites": [- {- "email": "[email protected]",- "role": "EDITOR",- "name": "bulk user 1",- },- {- "email": "[email protected]",- "role": "VIEWER",- "name": "bulk user 2",- },- ]- },- headers={"Authorization": f"Bearer {admin_token}"},- timeout=5,- )- assert response.status_code == HTTPStatus.CREATED, response.text--def test_delete_user(signoz: SigNoz,get_token: Callable[[str, str], str],