Skip to content

Commit

Permalink
chore: page title and summary could be empty
Browse files Browse the repository at this point in the history
Signed-off-by: Wei Zhang <[email protected]>
  • Loading branch information
zwpaper committed Jan 14, 2025
1 parent 2e114e6 commit fd84d68
Show file tree
Hide file tree
Showing 7 changed files with 763 additions and 606 deletions.
4 changes: 2 additions & 2 deletions ee/tabby-db/migrations/0042_page-section.up.sql
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ CREATE TABLE pages(
-- The user who created the page
author_id INTEGER NOT NULL,

title TEXT NOT NULL,
summary TEXT NOT NULL,
title TEXT,
summary TEXT,

created_at TIMESTAMP NOT NULL DEFAULT (DATETIME('now')),
updated_at TIMESTAMP NOT NULL DEFAULT (DATETIME('now')),
Expand Down
Binary file modified ee/tabby-db/schema.sqlite
Binary file not shown.
21 changes: 21 additions & 0 deletions ee/tabby-db/schema/schema.sql
Original file line number Diff line number Diff line change
Expand Up @@ -261,3 +261,24 @@ CREATE TABLE ldap_credential(
created_at TIMESTAMP NOT NULL DEFAULT(DATETIME('now')),
updated_at TIMESTAMP NOT NULL DEFAULT(DATETIME('now'))
);
CREATE TABLE pages(
id INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
-- The user who created the page
author_id INTEGER NOT NULL,
title TEXT,
summary TEXT,
created_at TIMESTAMP NOT NULL DEFAULT(DATETIME('now')),
updated_at TIMESTAMP NOT NULL DEFAULT(DATETIME('now')),
FOREIGN KEY(author_id) REFERENCES users(id) ON DELETE CASCADE
);
CREATE TABLE page_sections(
id INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
page_id INTEGER NOT NULL,
position INTEGER NOT NULL,
title TEXT NOT NULL,
content TEXT NOT NULL,
created_at TIMESTAMP NOT NULL DEFAULT(DATETIME('now')),
updated_at TIMESTAMP NOT NULL DEFAULT(DATETIME('now')),
FOREIGN KEY(page_id) REFERENCES pages(id) ON DELETE CASCADE,
CONSTRAINT `page_id_position` UNIQUE(page_id, position)
);
1,276 changes: 676 additions & 600 deletions ee/tabby-db/schema/schema.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 2 additions & 2 deletions ee/tabby-db/src/pages.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ use crate::DbConn;
pub struct PageDAO {
pub id: i64,
pub author_id: i64,
pub title: String,
pub summary: String,
pub title: Option<String>,
pub summary: Option<String>,
pub created_at: DateTime<Utc>,
pub updated_at: DateTime<Utc>,
}
Expand Down
60 changes: 60 additions & 0 deletions ee/tabby-schema/graphql/schema.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,12 @@ input EmailSettingInput {
smtpPassword: String
}

input GenerateSectionInput {
pageId: ID!
position: Int!
content: String!
}

input MessageAttachmentCodeInput {
filepath: String
"When start line is `None`, it represents the entire file." startLine: Int
Expand All @@ -206,6 +212,12 @@ input PasswordResetInput {
password2: String!
}

input ReorderSectionsInput {
pageId: ID!
id: ID!
position: Int!
}

input RequestInvitationInput {
email: String!
}
Expand Down Expand Up @@ -652,6 +664,13 @@ type Mutation {
"Turn on persisted status for a thread."
setThreadPersisted(threadId: ID!): Boolean!
updateThreadMessage(input: UpdateMessageInput!): Boolean!
convertThreadToPage(threadId: ID!): ID!
generatePageTitle(id: ID!): String!
generatePageSummary(id: ID!): String!
deletePage(id: ID!): ID!
generatePageSection(input: GenerateSectionInput!): Section!
reorderPageSections(input: ReorderSectionsInput!): Boolean!
deletePageSection(sectionId: ID!): ID!
createCustomDocument(input: CreateCustomDocumentInput!): ID!
deleteCustomDocument(id: ID!): Boolean!
setPresetDocumentActive(input: SetPresetDocumentActiveInput!): Boolean!
Expand Down Expand Up @@ -682,6 +701,25 @@ type OAuthCredential {
updatedAt: DateTime!
}

type Page {
id: ID!
authorId: ID!
title: String!
summary: String!
createdAt: DateTime!
updatedAt: DateTime!
}

type PageConnection {
edges: [PageEdge!]!
pageInfo: PageInfo!
}

type PageEdge {
node: Page!
cursor: String!
}

type PageInfo {
hasPreviousPage: Boolean!
hasNextPage: Boolean!
Expand Down Expand Up @@ -788,6 +826,8 @@ type Query {
Thread is public within an instance, so no need to check for ownership.
"""
threadMessages(threadId: ID!, after: String, before: String, first: Int, last: Int): MessageConnection!
pages(ids: [ID!], after: String, before: String, first: Int, last: Int): PageConnection!
pageSections(pageId: ID!, after: String, before: String, first: Int, last: Int): SectionConnection!
customWebDocuments(ids: [ID!], after: String, before: String, first: Int, last: Int): CustomDocumentConnection!
presetWebDocuments(ids: [ID!], after: String, before: String, first: Int, last: Int, isActive: Boolean): PresetDocumentConnection!
"List user groups."
Expand Down Expand Up @@ -834,6 +874,26 @@ type RepositoryGrepOutput {
elapsedMs: Int!
}

type Section {
id: ID!
pageId: ID!
position: Int!
title: String!
content: String!
createdAt: DateTime!
updatedAt: DateTime!
}

type SectionConnection {
edges: [SectionEdge!]!
pageInfo: PageInfo!
}

type SectionEdge {
node: Section!
cursor: String!
}

type SecuritySetting {
allowedRegisterDomainList: [String!]!
disableClientSideTelemetry: Boolean!
Expand Down
4 changes: 2 additions & 2 deletions ee/tabby-schema/src/schema/page/types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ use crate::{juniper::relay::NodeType, Context};
pub struct Page {
pub id: ID,
pub author_id: ID,
pub title: String,
pub summary: String,
pub title: Option<String>,
pub summary: Option<String>,
pub created_at: DateTime<Utc>,
pub updated_at: DateTime<Utc>,
}
Expand Down

0 comments on commit fd84d68

Please sign in to comment.