refactor: rename all page query to doc (#10019)

This commit is contained in:
forehalo
2025-02-07 11:40:59 +00:00
parent 4e00ddd5f1
commit 0b9d30b55a
34 changed files with 658 additions and 643 deletions
@@ -54,7 +54,7 @@ export function revokeDocUserRoles(
});
}
export function updatePageDefaultRole(
export function updateDocDefaultRole(
app: INestApplication,
token: string,
workspaceId: string,
@@ -68,7 +68,7 @@ export function updatePageDefaultRole(
.send({
query: `
mutation {
updatePageDefaultRole(input: {
updateDocDefaultRole(input: {
workspaceId: "${workspaceId}",
docId: "${docId}",
role: ${DocRole[role]}
@@ -78,7 +78,7 @@ export function updatePageDefaultRole(
});
}
export async function pageGrantedUsersList(
export async function docGrantedUsersList(
app: INestApplication,
token: string,
workspaceId: string,
@@ -94,14 +94,16 @@ export async function pageGrantedUsersList(
query: `
query {
workspace(id: "${workspaceId}") {
pageGrantedUsersList(pageId: "${docId}", pagination: { first: ${first}, offset: ${offset} }) {
totalCount
edges {
doc(docId: "${docId}") {
grantedUsersList(pagination: { first: ${first}, offset: ${offset} }) {
totalCount
edges {
cursor
node {
role
user {
id
node {
role
user {
id
}
}
}
}
@@ -103,11 +103,11 @@ export async function updateWorkspace(
return res.body.data.updateWorkspace.public;
}
export async function publishPage(
export async function publishDoc(
app: INestApplication,
token: string,
workspaceId: string,
pageId: string
docId: string
) {
const res = await request(app.getHttpServer())
.post(gql)
@@ -116,7 +116,7 @@ export async function publishPage(
.send({
query: `
mutation {
publishPage(workspaceId: "${workspaceId}", pageId: "${pageId}") {
publishDoc(workspaceId: "${workspaceId}", docId: "${docId}") {
id
mode
}
@@ -124,14 +124,14 @@ export async function publishPage(
`,
})
.expect(200);
return res.body.errors?.[0]?.message || res.body.data?.publishPage;
return res.body.errors?.[0]?.message || res.body.data?.publishDoc;
}
export async function revokePublicPage(
export async function revokePublicDoc(
app: INestApplication,
token: string,
workspaceId: string,
pageId: string
docId: string
) {
const res = await request(app.getHttpServer())
.post(gql)
@@ -140,7 +140,7 @@ export async function revokePublicPage(
.send({
query: `
mutation {
revokePublicPage(workspaceId: "${workspaceId}", pageId: "${pageId}") {
revokePublicDoc(workspaceId: "${workspaceId}", docId: "${docId}") {
id
mode
public
@@ -149,7 +149,7 @@ export async function revokePublicPage(
`,
})
.expect(200);
return res.body.errors?.[0]?.message || res.body.data?.revokePublicPage;
return res.body.errors?.[0]?.message || res.body.data?.revokePublicDoc;
}
export async function grantMember(