Skip to content

Commit

Permalink
feat(tag): retire unused tag queries and previous deprecated
Browse files Browse the repository at this point in the history
  • Loading branch information
gitwoz committed Nov 7, 2024
1 parent 9532ef7 commit 68986d1
Show file tree
Hide file tree
Showing 46 changed files with 58 additions and 3,062 deletions.
128 changes: 0 additions & 128 deletions schema.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -54,25 +54,9 @@ type Mutation {

"""Follow or unfollow tag."""
toggleFollowTag(input: ToggleItemInput!): Tag!

"""Create or update tag."""
putTag(input: PutTagInput!): Tag!

"""Update member, permission and othters of a tag."""
updateTagSetting(input: UpdateTagSettingInput!): Tag!

"""Add one tag to articles."""
addArticlesTags(input: AddArticlesTagsInput!): Tag!

"""Update articles' tag."""
updateArticlesTags(input: UpdateArticlesTagsInput!): Tag!

"""Delete one tag from articles"""
deleteArticlesTags(input: DeleteArticlesTagsInput!): Tag!
toggleArticleRecommend(input: ToggleRecommendInput!): Article!
updateArticleState(input: UpdateArticleStateInput!): Article!
updateArticleSensitive(input: UpdateArticleSensitiveInput!): Article!
toggleTagRecommend(input: ToggleRecommendInput!): Tag!
deleteTags(input: DeleteTagsInput!): Boolean
renameTag(input: RenameTagInput!): Tag!
mergeTags(input: MergeTagsInput!): Tag!
Expand Down Expand Up @@ -168,9 +152,6 @@ type Mutation {
"""Reset user or payment password."""
resetPassword(input: ResetPasswordInput!): Boolean

"""Change user email."""
changeEmail(input: ChangeEmailInput!): User! @deprecated(reason: "use 'setEmail' instead")

"""Set user email."""
setEmail(input: SetEmailInput!): User!

Expand All @@ -180,11 +161,7 @@ type Mutation {
"""Set user currency preference."""
setCurrency(input: SetCurrencyInput!): User!

"""Register user, can only be used on matters.{town,news} website."""
userRegister(input: UserRegisterInput!): AuthResult! @deprecated(reason: "use 'emailLogin' instead")

"""Login user."""
userLogin(input: UserLoginInput!): AuthResult! @deprecated(reason: "use 'emailLogin' instead")
emailLogin(input: EmailLoginInput!): AuthResult!

"""Get signing message."""
Expand All @@ -208,15 +185,9 @@ type Mutation {
"""Remove a social login from current user."""
removeSocialLogin(input: RemoveSocialLoginInput!): User!

"""Reset crypto wallet."""
resetWallet(input: ResetWalletInput!): User! @deprecated(reason: "use 'removeWalletLogin' instead")

"""Logout user."""
userLogout: Boolean!

"""Generate or claim a Liker ID through LikeCoin"""
generateLikerId: User! @deprecated(reason: "No longer in use")

"""Reset Liker ID"""
resetLikerId(input: ResetLikerIdInput!): User!

Expand Down Expand Up @@ -413,7 +384,6 @@ type Article implements Node & PinnableWork {
"""
This value determines if this article is an author selected article or not.
"""
sticky: Boolean! @deprecated(reason: "Use pinned instead")
pinned: Boolean!

"""Translation of article title and content."""
Expand All @@ -431,9 +401,6 @@ type Article implements Node & PinnableWork {
"""Cumulative reading time in seconds"""
readTime: Float!

"""Drafts linked to this article."""
drafts: [Draft!] @deprecated(reason: "Use Article.newestUnpublishedDraft or Article.newestPublishedDraft instead")

"""Newest unpublished draft linked to this article."""
newestUnpublishedDraft: Draft

Expand Down Expand Up @@ -551,42 +518,15 @@ type Tag implements Node {
articles(input: TagArticlesInput!): ArticleConnection!
articlesExcludeSpam(input: TagArticlesInput!): ArticleConnection!

"""This value determines if this article is selected by this tag or not."""
selected(input: TagSelectedInput!): Boolean!

"""Time of this tag was created."""
createdAt: DateTime!

"""Tag's cover link."""
cover: String

"""Description of this tag."""
description: String

"""Editors of this tag."""
editors(input: TagEditorsInput): [User!]

"""Creator of this tag."""
creator: User

"""Owner of this tag."""
owner: User

"""This value determines if current viewer is following or not."""
isFollower: Boolean

"""Followers of this tag."""
followers(input: ConnectionArgs!): UserConnection!

"""Participants of this tag."""
participants(input: ConnectionArgs!): UserConnection!

"""Tags recommended based on relations to current tag."""
recommended(input: ConnectionArgs!): TagConnection!

"""This value determines if it is official."""
isOfficial: Boolean

"""Counts of this tag."""
numArticles: Int!
numAuthors: Int!
Expand Down Expand Up @@ -639,7 +579,6 @@ type ArticleTranslation {
type TagOSS {
boost: Float!
score: Float!
selected: Boolean!
}

type ArticleConnection implements Connection {
Expand Down Expand Up @@ -695,9 +634,6 @@ input PublishArticleInput {
input EditArticleInput {
id: ID!
state: ArticleState

"""deprecated, use pinned instead"""
sticky: Boolean
pinned: Boolean
title: String
summary: String
Expand Down Expand Up @@ -772,36 +708,6 @@ input MergeTagsInput {
content: String!
}

input PutTagInput {
id: ID
content: String
cover: ID
description: String
}

input UpdateTagSettingInput {
id: ID!
type: UpdateTagSettingType!
editors: [ID!]
}

input AddArticlesTagsInput {
id: ID!
articles: [ID!]
selected: Boolean
}

input UpdateArticlesTagsInput {
id: ID!
articles: [ID!]
isSelected: Boolean!
}

input DeleteArticlesTagsInput {
id: ID!
articles: [ID!]
}

enum TagArticlesSortBy {
byHottestDesc
byCreatedAtDesc
Expand All @@ -815,16 +721,6 @@ input TagArticlesInput {
sortBy: TagArticlesSortBy = byCreatedAtDesc
}

input TagSelectedInput {
id: ID
mediaHash: String
}

input TagEditorsInput {
excludeAdmin: Boolean
excludeOwner: Boolean
}

input TransactionsReceivedByArgs {
after: String
first: Int
Expand Down Expand Up @@ -874,14 +770,6 @@ enum RecommendTypes {
search
}

enum UpdateTagSettingType {
adopt
leave
add_editor
remove_editor
leave_editor
}

input CampaignInput {
shortHash: String!
}
Expand Down Expand Up @@ -2580,9 +2468,6 @@ type Recommendation {
"""Activities based on user's following, sort by creation time."""
following(input: RecommendationFollowingInput!): FollowingActivityConnection!

"""Articles recommended based on recently read article tags."""
readTagsArticles(input: ConnectionArgs!): ArticleConnection! @deprecated(reason: "Merged into following")

"""Global articles sort by publish time."""
newest(input: ConnectionArgs!): ArticleConnection!
newestExcludeSpam(input: ConnectionArgs!): ArticleConnection!
Expand Down Expand Up @@ -2802,9 +2687,6 @@ type Liker {

"""Total LIKE left in wallet."""
total: Float!

"""Rate of LikeCoin/USD"""
rateUSD: Float @deprecated(reason: "No longer in use")
}

type UserOSS {
Expand Down Expand Up @@ -3145,12 +3027,6 @@ input WalletLoginInput {
"""nonce from generateSigningMessage"""
nonce: String!

"""required for wallet register"""
email: String @deprecated(reason: "No longer in use")

"""email verification code, required for wallet register"""
codeId: ID @deprecated(reason: "No longer in use")

"""used in register"""
language: UserLanguage
referralCode: String
Expand All @@ -3171,7 +3047,6 @@ input UpdateNotificationSettingInput {

input UpdateUserInfoInput {
displayName: String
userName: String @deprecated(reason: "use 'setUserName' instead")
avatar: ID
description: String
language: UserLanguage
Expand Down Expand Up @@ -3265,9 +3140,6 @@ enum VerificationCodeType {
register
email_verify
email_otp
email_reset @deprecated(reason: "No longer in use")
email_reset_confirm @deprecated(reason: "No longer in use")
password_reset @deprecated(reason: "No longer in use")
payment_password_reset
}

Expand Down
19 changes: 3 additions & 16 deletions src/connectors/__test__/tagService.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -123,23 +123,10 @@ describe('findArticleIds', () => {
})
})

test('findArticleCovers', async () => {
const covers = await tagService.findArticleCovers({ id: '2' })
expect(covers).toBeDefined()

const cached = await tagService.findArticleCovers({ id: '2' })
expect(cached).toEqual(covers)
})

test('create', async () => {
const content = 'foo'
const tag = await tagService.create(
{
content,
creator: '0',
editors: [],
owner: '0',
},
{ content, creator: '0' },
{
columns: ['id', 'content'],
}
Expand Down Expand Up @@ -245,13 +232,13 @@ describe('findByAuthorUsage', () => {

await tagService.createArticleTags({
articleIds: [article1.id],
creator: article1.authorId,
tagIds: ['1', '2'],
creator: article1.authorId,
})
await tagService.createArticleTags({
articleIds: [article2.id],
creator: article2.authorId,
tagIds: ['2', '3'],
creator: article1.authorId,
})

const [tags, totalCount] = await tagService.findByAuthorUsage({
Expand Down
Loading

0 comments on commit 68986d1

Please sign in to comment.