Files
codegen-sh[bot]andTom Moor 11cff77162 Add installation.create API endpoint (#9324)
* Add installation.create API endpoint

- Add new endpoint that accepts teamName, userName, userEmail
- Use accountProvisioner to create team and user
- Only allow when no existing teams exist (unauthenticated)
- Add comprehensive tests for success, failure, and validation cases
- Add schema validation with Zod
- Include rate limiting (5 per hour)
- Follow existing API patterns and conventions

* Remove changes to .env.test

* fix

* Centralize validation

* test

* test

* test

---------

Co-authored-by: codegen-sh[bot] <131295404+codegen-sh[bot]@users.noreply.github.com>
Co-authored-by: Tom Moor <tom@getoutline.com>
2025-05-29 22:52:49 -04:00

19 lines
598 B
TypeScript

import { z } from "zod";
import { TeamValidation, UserValidation } from "@shared/validations";
import { BaseSchema } from "@server/routes/api/schema";
export const InstallationCreateSchema = BaseSchema.extend({
body: z.object({
/** Team name */
teamName: z.string().min(1).max(TeamValidation.maxNameLength),
/** User name */
userName: z.string().min(1).max(UserValidation.maxNameLength),
/** User email */
userEmail: z.string().email().max(UserValidation.maxEmailLength),
}),
});
export type InstallationCreateSchemaReq = z.infer<
typeof InstallationCreateSchema
>;