diff --git a/apps/client/src/stores/admin-role.ts b/apps/client/src/stores/admin-role.ts index fa70004e0f..1cb228367e 100644 --- a/apps/client/src/stores/admin-role.ts +++ b/apps/client/src/stores/admin-role.ts @@ -1,4 +1,4 @@ -import type { AdminRole, adminRoleContract } from '@cpn-console/shared' +import type { AdminRole, PatchAdminRolesBody } from '@cpn-console/shared' import { AdminAuthorized } from '@cpn-console/shared' import { defineStore } from 'pinia' import { ref } from 'vue' @@ -42,7 +42,7 @@ export const useAdminRoleStore = defineStore('adminRole', () => { } const patchRoles = async ( - body: typeof adminRoleContract.patchAdminRoles.body._type, + body: PatchAdminRolesBody, ) => { roles.value = await apiClient.AdminRoles.patchAdminRoles({ body, diff --git a/apps/client/src/stores/admin-token.ts b/apps/client/src/stores/admin-token.ts index 3b76dc2fe8..4134f6d1d1 100644 --- a/apps/client/src/stores/admin-token.ts +++ b/apps/client/src/stores/admin-token.ts @@ -1,10 +1,10 @@ -import type { AdminToken, adminTokenContract } from '@cpn-console/shared' +import type { AdminToken, CreateAdminTokenBody, ListAdminTokensQuery } from '@cpn-console/shared' import { defineStore } from 'pinia' import { apiClient, extractData } from '../api/xhr-client.js' export const useAdminTokenStore = defineStore('adminToken', () => { const listTokens = async ( - query: typeof adminTokenContract.listAdminTokens.query._type = {}, + query: ListAdminTokensQuery = {}, ) => { return apiClient.AdminTokens.listAdminTokens({ query }).then( (response: any) => extractData(response, 200), @@ -12,7 +12,7 @@ export const useAdminTokenStore = defineStore('adminToken', () => { } const createToken = async ( - body: typeof adminTokenContract.createAdminToken.body._type, + body: CreateAdminTokenBody, ) => { return apiClient.AdminTokens.createAdminToken({ body }).then((res: any) => extractData(res, 201), diff --git a/apps/client/src/stores/project.ts b/apps/client/src/stores/project.ts index 44e59d56a8..eaa896c160 100644 --- a/apps/client/src/stores/project.ts +++ b/apps/client/src/stores/project.ts @@ -1,6 +1,6 @@ import type { CreateProjectBody, - projectContract, + ListProjectsQuery, ProjectV2, } from '@cpn-console/shared' import pDebounce from 'p-debounce' @@ -60,7 +60,7 @@ export const useProjectStore = defineStore('project', () => { } const listProjects = async ( - query: typeof projectContract.listProjects.query._type = { + query: ListProjectsQuery = { filter: 'member', statusNotIn: 'archived', }, diff --git a/apps/client/src/stores/system-settings.ts b/apps/client/src/stores/system-settings.ts index 8eebac262e..45d2aa01de 100644 --- a/apps/client/src/stores/system-settings.ts +++ b/apps/client/src/stores/system-settings.ts @@ -1,6 +1,6 @@ import type { + ListSystemSettingsQuery, SystemSettings, - systemSettingsContract, UpsertSystemSettingBody, } from '@cpn-console/shared' import { @@ -13,7 +13,7 @@ export const useSystemSettingsStore = defineStore('systemSettings', () => { const systemSettings = ref([]) const systemSettingsByKey = computed(() => resourceListToDictByKey(systemSettings.value)) - const listSystemSettings = async (query: typeof systemSettingsContract.listSystemSettings.query._type = {}) => { + const listSystemSettings = async (query: ListSystemSettingsQuery = {}) => { systemSettings.value = await apiClient.SystemSettings.listSystemSettings(query) .then((response: any) => extractData(response, 200)) } diff --git a/apps/client/src/utils/project-utils.ts b/apps/client/src/utils/project-utils.ts index 4fb2770113..159e728111 100644 --- a/apps/client/src/utils/project-utils.ts +++ b/apps/client/src/utils/project-utils.ts @@ -1,16 +1,16 @@ import type { CreateDeploymentBody, CreateEnvironment, + CreateProjectRoleBody, CreateRepositoryBodyV2, Deployment, Environment, EnvironmentWithDeploymentsCount, GetLogsQuery, + PatchMembersBody, + PatchProjectRolesBody, PermissionTarget, PluginsUpdateBody, - projectContract, - projectMemberContract, - projectRoleContract, ProjectService, ProjectV2, Repo, @@ -18,6 +18,7 @@ import type { SyncRepositoryBodyV2, UpdateDeploymentBody, UpdateEnvironment, + UpdateProjectBody, UpdateRepositoryBodyV2, User, } from '@cpn-console/shared' @@ -147,7 +148,7 @@ export class Project implements ProjectV2 { } Commands = { - update: async (data: typeof projectContract.updateProject.body._type) => { + update: async (data: UpdateProjectBody) => { const callback = this.addOperation('update') try { const project = await apiClient.Projects.updateProject({ body: data, params: { projectId: this.id } }) @@ -222,7 +223,7 @@ export class Project implements ProjectV2 { return this.Members.list() } finally { callback() } }, - patch: async (body: typeof projectMemberContract.patchMembers.body._type) => { + patch: async (body: PatchMembersBody) => { const callback = this.addOperation('teamManagement') try { await apiClient.ProjectsMembers.patchMembers({ params: { projectId: this.id }, body }) @@ -360,7 +361,7 @@ export class Project implements ProjectV2 { this.computePerms() return this.roles }, - patch: async (body: typeof projectRoleContract.patchProjectRoles.body._type) => { + patch: async (body: PatchProjectRolesBody) => { const callback = this.addOperation('roleManagement') try { this.roles = await apiClient.ProjectsRoles.patchProjectRoles({ body, params: { projectId: this.id } }) @@ -369,7 +370,7 @@ export class Project implements ProjectV2 { return this.roles } finally { callback() } }, - create: async (body: typeof projectRoleContract.createProjectRole.body._type) => { + create: async (body: CreateProjectRoleBody) => { this.roles = await apiClient.ProjectsRoles.createProjectRole({ body, params: { projectId: this.id } }) .then((response: any) => extractData(response, 201)) this.computePerms() diff --git a/apps/client/src/views/CreateProject.vue b/apps/client/src/views/CreateProject.vue index 797df6602d..a459f92d20 100644 --- a/apps/client/src/views/CreateProject.vue +++ b/apps/client/src/views/CreateProject.vue @@ -1,6 +1,6 @@