-
-
Notifications
You must be signed in to change notification settings - Fork 115
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 workspace-role schemas and types to…
… @keyshade/schema (#568)
- Loading branch information
Showing
13 changed files
with
755 additions
and
399 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 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 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 |
---|---|---|
@@ -1,11 +1,11 @@ | ||
{ | ||
"name": "eslint-config-custom", | ||
"license": "MIT", | ||
"version": "0.0.0", | ||
"private": true, | ||
"devDependencies": { | ||
"@vercel/style-guide": "^5.0.0", | ||
"eslint-config-turbo": "^1.10.12", | ||
"typescript": "^4.5.3" | ||
} | ||
} | ||
"name": "eslint-config-custom", | ||
"license": "MIT", | ||
"version": "0.0.0", | ||
"private": true, | ||
"devDependencies": { | ||
"@vercel/style-guide": "^5.0.0", | ||
"eslint-config-turbo": "^2.3.1", | ||
"typescript": "^4.5.3" | ||
} | ||
} |
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 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,77 @@ | ||
import { authorityEnum } from '@/enums' | ||
import { PageRequestSchema, PageResponseSchema } from '@/pagination' | ||
import { BaseProjectSchema } from '@/project' | ||
import { WorkspaceSchema } from '@/workspace' | ||
import { z } from 'zod' | ||
|
||
export const WorkspaceRoleSchema = z.object({ | ||
id: z.string(), | ||
name: z.string(), | ||
slug: z.string(), | ||
description: z.string().nullable(), | ||
colorCode: z.string().nullable(), | ||
hasAdminAuthority: z.boolean(), | ||
createdAt: z.string().datetime(), | ||
updatedAt: z.string().datetime(), | ||
authorities: z.array(authorityEnum), | ||
workspaceId: WorkspaceSchema.shape.id, | ||
projects: z.array( | ||
z.object({ | ||
project: z.object({ | ||
id: BaseProjectSchema.shape.id, | ||
name: BaseProjectSchema.shape.name, | ||
slug: BaseProjectSchema.shape.slug | ||
}) | ||
}) | ||
) | ||
}) | ||
|
||
export const CreateWorkspaceRoleRequestSchema = z.object({ | ||
workspaceSlug: WorkspaceSchema.shape.slug, | ||
name: WorkspaceRoleSchema.shape.name, | ||
description: z.string().optional(), | ||
colorCode: z.string().optional(), | ||
authorities: z.array(authorityEnum).optional(), | ||
projectSlugs: z.array(BaseProjectSchema.shape.slug).optional() | ||
}) | ||
|
||
export const CreateWorkspaceRoleResponseSchema = WorkspaceRoleSchema | ||
|
||
export const UpdateWorkspaceRoleRequestSchema = | ||
CreateWorkspaceRoleRequestSchema.partial().extend({ | ||
workspaceRoleSlug: WorkspaceRoleSchema.shape.slug | ||
}) | ||
|
||
export const UpdateWorkspaceRoleResponseSchema = WorkspaceRoleSchema | ||
|
||
export const DeleteWorkspaceRoleRequestSchema = z.object({ | ||
workspaceRoleSlug: WorkspaceRoleSchema.shape.slug | ||
}) | ||
|
||
export const DeleteWorkspaceRoleResponseSchema = z.void() | ||
|
||
export const CheckWorkspaceRoleExistsRequestSchema = z.object({ | ||
workspaceSlug: WorkspaceSchema.shape.slug, | ||
workspaceRoleName: WorkspaceRoleSchema.shape.name | ||
}) | ||
|
||
export const CheckWorkspaceRoleExistsResponseSchema = z.object({ | ||
exists: z.boolean() | ||
}) | ||
|
||
export const GetWorkspaceRoleRequestSchema = z.object({ | ||
workspaceRoleSlug: WorkspaceRoleSchema.shape.slug | ||
}) | ||
|
||
export const GetWorkspaceRoleResponseSchema = WorkspaceRoleSchema | ||
|
||
export const GetWorkspaceRolesOfWorkspaceRequestSchema = | ||
PageRequestSchema.merge( | ||
z.object({ | ||
workspaceSlug: WorkspaceSchema.shape.slug | ||
}) | ||
) | ||
|
||
export const GetWorkspaceRolesOfWorkspaceResponseSchema = PageResponseSchema( | ||
WorkspaceRoleSchema.omit({ projects: true }) | ||
) |
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,67 @@ | ||
import { z } from 'zod' | ||
|
||
import { | ||
WorkspaceRoleSchema, | ||
CreateWorkspaceRoleRequestSchema, | ||
CreateWorkspaceRoleResponseSchema, | ||
UpdateWorkspaceRoleRequestSchema, | ||
UpdateWorkspaceRoleResponseSchema, | ||
DeleteWorkspaceRoleRequestSchema, | ||
DeleteWorkspaceRoleResponseSchema, | ||
CheckWorkspaceRoleExistsRequestSchema, | ||
CheckWorkspaceRoleExistsResponseSchema, | ||
GetWorkspaceRoleRequestSchema, | ||
GetWorkspaceRoleResponseSchema, | ||
GetWorkspaceRolesOfWorkspaceRequestSchema, | ||
GetWorkspaceRolesOfWorkspaceResponseSchema | ||
} from './' | ||
|
||
export type WorkspaceRole = z.infer<typeof WorkspaceRoleSchema> | ||
|
||
export type CreateWorkspaceRoleRequest = z.infer< | ||
typeof CreateWorkspaceRoleRequestSchema | ||
> | ||
|
||
export type CreateWorkspaceRoleResponse = z.infer< | ||
typeof CreateWorkspaceRoleResponseSchema | ||
> | ||
|
||
export type UpdateWorkspaceRoleRequest = z.infer< | ||
typeof UpdateWorkspaceRoleRequestSchema | ||
> | ||
|
||
export type UpdateWorkspaceRoleResponse = z.infer< | ||
typeof UpdateWorkspaceRoleResponseSchema | ||
> | ||
|
||
export type DeleteWorkspaceRoleRequest = z.infer< | ||
typeof DeleteWorkspaceRoleRequestSchema | ||
> | ||
|
||
export type DeleteWorkspaceRoleResponse = z.infer< | ||
typeof DeleteWorkspaceRoleResponseSchema | ||
> | ||
|
||
export type CheckWorkspaceRoleExistsRequest = z.infer< | ||
typeof CheckWorkspaceRoleExistsRequestSchema | ||
> | ||
|
||
export type CheckWorkspaceRoleExistsResponse = z.infer< | ||
typeof CheckWorkspaceRoleExistsResponseSchema | ||
> | ||
|
||
export type GetWorkspaceRoleRequest = z.infer< | ||
typeof GetWorkspaceRoleRequestSchema | ||
> | ||
|
||
export type GetWorkspaceRoleResponse = z.infer< | ||
typeof GetWorkspaceRoleResponseSchema | ||
> | ||
|
||
export type GetWorkspaceRolesOfWorkspaceRequest = z.infer< | ||
typeof GetWorkspaceRolesOfWorkspaceRequestSchema | ||
> | ||
|
||
export type GetWorkspaceRolesOfWorkspaceResponse = z.infer< | ||
typeof GetWorkspaceRolesOfWorkspaceResponseSchema | ||
> |
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 |
---|---|---|
@@ -1,4 +1,3 @@ | ||
import { z } from 'zod' | ||
import { | ||
integrationTypeEnum, | ||
expiresAfterEnum, | ||
|
Oops, something went wrong.