Skip to content

Commit 0f2c5cb

Browse files
author
Jerry
committed
feat(likecoin): remove likecoin
1 parent bcab2c9 commit 0f2c5cb

File tree

13 files changed

+2
-821
lines changed

13 files changed

+2
-821
lines changed

.github/workflows/lambda-deploy.yml

Lines changed: 0 additions & 76 deletions
Original file line numberDiff line numberDiff line change
@@ -641,79 +641,3 @@ jobs:
641641
lambdaTimeout=10,
642642
lambdaMemorySize=256,
643643
cronExpression="rate(1 hour)"
644-
645-
deploy-likecoin-update-civic-liker-cache:
646-
needs: build-lambda-image
647-
runs-on: ubuntu-latest
648-
steps:
649-
- name: Checkout Repo
650-
uses: actions/checkout@master
651-
652-
- name: Login to Amazon ECR
653-
id: login-ecr
654-
uses: aws-actions/amazon-ecr-login@v2
655-
656-
- name: Deploy Lambda
657-
uses: aws-actions/aws-cloudformation-github-deploy@v1
658-
with:
659-
name: likecoin-update-civic-liker-cache-${{ inputs.environment }}
660-
template: ./deployment/lambda/queuejob.yml
661-
parameter-overrides: >-
662-
mattersEnv=${{ env.MATTERS_ENV }},
663-
imageUri=${{ steps.login-ecr.outputs.registry }}/${{ env.ECR_REPOSITORY }}:matters-server-${{ github.SHA }},
664-
lambdaCMD=likecoinUpdateCivicLikerCache.handler,
665-
lambdaTimeout=30,
666-
lambdaMemorySize=512,
667-
lambdaReservedConcurrency=200,
668-
sqsArn=arn:aws:sqs:${{ secrets.AWS_REGION }}:${{ secrets.AWS_ACCOUNT_ID }}:likecoin-update-civic-liker-cache-${{ env.SQS_ENV }},
669-
sqsBatchSize=100,
670-
sqsMaxBatchingWindowInSeconds=1
671-
672-
deploy-likecoin-like:
673-
needs: build-lambda-image
674-
runs-on: ubuntu-latest
675-
steps:
676-
- name: Checkout Repo
677-
uses: actions/checkout@master
678-
679-
- name: Login to Amazon ECR
680-
id: login-ecr
681-
uses: aws-actions/amazon-ecr-login@v2
682-
683-
- name: Deploy Lambda
684-
uses: aws-actions/aws-cloudformation-github-deploy@v1
685-
with:
686-
name: likecoin-like-${{ inputs.environment }}
687-
template: ./deployment/lambda/queuejob.yml
688-
parameter-overrides: >-
689-
mattersEnv=${{ env.MATTERS_ENV }},
690-
imageUri=${{ steps.login-ecr.outputs.registry }}/${{ env.ECR_REPOSITORY }}:matters-server-${{ github.SHA }},
691-
lambdaCMD=likecoinLike.handler,
692-
lambdaTimeout=120,
693-
lambdaMemorySize=512,
694-
sqsArn=arn:aws:sqs:${{ secrets.AWS_REGION }}:${{ secrets.AWS_ACCOUNT_ID }}:likecoin-like-${{ env.SQS_ENV }}.fifo,
695-
sqsBatchSize=10,
696-
sqsMaxBatchingWindowInSeconds=0
697-
698-
deploy-likecoin-batch-update-civic-liker-caches:
699-
needs: build-lambda-image
700-
runs-on: ubuntu-latest
701-
steps:
702-
- name: Checkout Repo
703-
uses: actions/checkout@master
704-
705-
- name: Login to Amazon ECR
706-
id: login-ecr
707-
uses: aws-actions/amazon-ecr-login@v2
708-
709-
- name: Deploy Lambda
710-
uses: aws-actions/aws-cloudformation-github-deploy@v1
711-
with:
712-
name: likecoin-batch-update-civic-liker-caches-${{ inputs.environment }}
713-
template: ./deployment/lambda/api.yml
714-
parameter-overrides: >-
715-
mattersEnv=${{ env.MATTERS_ENV }},
716-
imageUri=${{ steps.login-ecr.outputs.registry }}/${{ env.ECR_REPOSITORY }}:matters-server-${{ github.SHA }},
717-
lambdaCMD=likecoinBatchUpdateCivicLikerCaches.handler,
718-
lambdaTimeout=20,
719-
lambdaMemorySize=512

src/common/enums/sqs.ts

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,6 @@ export const QUEUE_URL = {
66
// notification
77
notification: environment?.awsNotificationQueueUrl,
88

9-
// likecoin
10-
likecoinLike: environment?.awsLikecoinLikeUrl,
11-
likecoinSendPV: environment?.awsLikecoinSendPVUrl,
12-
likecoinUpdateCivicLikerCache: environment?.awsLikecoinUpdateCivicLikerCache,
13-
149
// sendmail
1510
mail: environment?.awsMailQueueUrl,
1611
expressMail: environment?.awsExpressMailQueueUrl,

src/connectors/__test__/likecoin.test.ts

Lines changed: 0 additions & 56 deletions
This file was deleted.

src/connectors/article/ipfsPublicationService.ts

Lines changed: 0 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ import type {
22
Connections,
33
ArticleVersion,
44
Article,
5-
UserOAuthLikeCoin,
65
} from '#definitions/index.js'
76
import type { Knex } from 'knex'
87

@@ -24,7 +23,6 @@ import { PinataSDK } from 'pinata-web3'
2423

2524
import { AtomService } from '../atomService.js'
2625
import { aws } from '../aws/index.js'
27-
import { LikeCoin } from '../likecoin/index.js'
2826

2927
const logger = getLogger('service-ipfs-publication')
3028

@@ -36,15 +34,13 @@ export class IPFSPublicationService {
3634
private knexRO: Knex
3735
private models: AtomService
3836
private aws: typeof aws
39-
private likecoin: LikeCoin
4037

4138
public constructor(connections: Connections) {
4239
this.connections = connections
4340
this.models = new AtomService(connections)
4441
this.knex = connections.knex
4542
this.knexRO = connections.knexRO
4643
this.aws = aws
47-
this.likecoin = new LikeCoin(connections)
4844
}
4945

5046
private async initStorachaClient() {
@@ -352,54 +348,6 @@ export class IPFSPublicationService {
352348
}
353349
})
354350

355-
// publish to ISCN
356-
try {
357-
const draft = await this.models.findFirst({
358-
table: 'draft',
359-
where: { articleId },
360-
})
361-
362-
if (article && draft && draft.iscnPublish) {
363-
const author = await this.models.findFirst({
364-
table: 'user',
365-
where: { id: draft.authorId },
366-
})
367-
368-
let liker: UserOAuthLikeCoin | undefined
369-
if (author?.likerId) {
370-
liker = await this.models.findFirst({
371-
table: 'user_oauth_likecoin',
372-
where: { likerId: author.likerId },
373-
})
374-
}
375-
376-
if (liker && author) {
377-
const cosmosWallet = await this.likecoin.getCosmosWallet({ liker })
378-
379-
const { displayName, userName } = author
380-
const iscnId = await this.likecoin.iscnPublish({
381-
mediaHash: `hash://sha256/${mediaHash}`,
382-
ipfsHash: `ipfs://${dataHash}`,
383-
cosmosWallet,
384-
userName: `${displayName} (@${userName})`,
385-
title: articleVersion.title,
386-
description: articleVersion.summary,
387-
datePublished: article.createdAt?.toISOString().substring(0, 10),
388-
url: `https://${environment.siteDomain}/a/${article.shortHash}`,
389-
tags: articleVersion.tags,
390-
liker,
391-
})
392-
393-
await this.knex('article_version')
394-
.where({ id: articleVersionId })
395-
.update({ iscnId })
396-
}
397-
}
398-
} catch (err) {
399-
console.log('Failed to publish to ISCN')
400-
console.error(err)
401-
}
402-
403351
// invalidate cache
404352
await invalidateFQC({
405353
node: { type: NODE_TYPES.Article, id: articleId },

src/connectors/index.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ export * from './aws/index.js'
22
export * from './cache/index.js'
33
export * from './cloudflare/index.js'
44
export * from './mail/index.js'
5-
export * from './likecoin/index.js'
65
export * from './opensea/index.js'
76
export * from './alchemy/index.js'
87
export * from './passphrases/index.js'

0 commit comments

Comments
 (0)