forked from keyshade-xyz/keyshade
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(schema, api-client): Migrate project schemas and environment sch…
…emas along with their types to @keyshade/schema (keyshade-xyz#538)
- Loading branch information
Showing
14 changed files
with
1,145 additions
and
212 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
import { z } from 'zod' | ||
import { PageRequestSchema, PageResponseSchema } from '@/pagination/pagination' | ||
|
||
export const EnvironmentSchema = z.object({ | ||
id: z.string(), | ||
name: z.string(), | ||
slug: z.string(), | ||
description: z.string().nullable(), | ||
createdAt: z.string(), | ||
updatedAt: z.string(), | ||
lastUpdatedById: z.string(), | ||
projectId: z.string() | ||
}) | ||
|
||
export const CreateEnvironmentRequestSchema = z.object({ | ||
name: z.string(), | ||
description: z.string().optional(), | ||
projectId: z.string() | ||
}) | ||
|
||
export const CreateEnvironmentResponseSchema = EnvironmentSchema | ||
|
||
export const UpdateEnvironmentRequestSchema = | ||
CreateEnvironmentRequestSchema.omit({ projectId: true }) | ||
.partial() | ||
.extend({ slug: z.string() }) | ||
|
||
export const UpdateEnvironmentResponseSchema = EnvironmentSchema | ||
|
||
export const GetEnvironmentRequestSchema = z.object({ | ||
slug: z.string() | ||
}) | ||
|
||
export const GetEnvironmentResponseSchema = EnvironmentSchema | ||
|
||
export const GetAllEnvironmentsOfProjectRequestSchema = | ||
PageRequestSchema.extend({ | ||
projectSlug: z.string() | ||
}) | ||
|
||
export const GetAllEnvironmentsOfProjectResponseSchema = PageResponseSchema( | ||
EnvironmentSchema.extend({ | ||
lastUpdatedBy: z.object({ | ||
id: z.string(), | ||
name: z.string(), | ||
email: z.string(), | ||
profilePictureUrl: z.string().nullable() | ||
}) | ||
}) | ||
) | ||
|
||
export const DeleteEnvironmentRequestSchema = z.object({ | ||
slug: z.string() | ||
}) | ||
|
||
export const DeleteEnvironmentResponseSchema = z.void() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
import { z } from 'zod' | ||
import { | ||
EnvironmentSchema, | ||
CreateEnvironmentRequestSchema, | ||
CreateEnvironmentResponseSchema, | ||
UpdateEnvironmentRequestSchema, | ||
UpdateEnvironmentResponseSchema, | ||
GetEnvironmentRequestSchema, | ||
GetEnvironmentResponseSchema, | ||
GetAllEnvironmentsOfProjectRequestSchema, | ||
GetAllEnvironmentsOfProjectResponseSchema, | ||
DeleteEnvironmentRequestSchema, | ||
DeleteEnvironmentResponseSchema | ||
} from '.' | ||
|
||
export type Environment = z.infer<typeof EnvironmentSchema> | ||
|
||
export type CreateEnvironmentRequest = z.infer< | ||
typeof CreateEnvironmentRequestSchema | ||
> | ||
|
||
export type CreateEnvironmentResponse = z.infer< | ||
typeof CreateEnvironmentResponseSchema | ||
> | ||
|
||
export type UpdateEnvironmentRequest = z.infer< | ||
typeof UpdateEnvironmentRequestSchema | ||
> | ||
|
||
export type UpdateEnvironmentResponse = z.infer< | ||
typeof UpdateEnvironmentResponseSchema | ||
> | ||
|
||
export type GetEnvironmentRequest = z.infer<typeof GetEnvironmentRequestSchema> | ||
|
||
export type GetEnvironmentResponse = z.infer< | ||
typeof GetEnvironmentResponseSchema | ||
> | ||
|
||
export type GetAllEnvironmentsOfProjectRequest = z.infer< | ||
typeof GetAllEnvironmentsOfProjectRequestSchema | ||
> | ||
|
||
export type GetAllEnvironmentsOfProjectResponse = z.infer< | ||
typeof GetAllEnvironmentsOfProjectResponseSchema | ||
> | ||
|
||
export type DeleteEnvironmentRequest = z.infer< | ||
typeof DeleteEnvironmentRequestSchema | ||
> | ||
|
||
export type DeleteEnvironmentResponse = z.infer< | ||
typeof DeleteEnvironmentResponseSchema | ||
> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.