Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
76 changes: 0 additions & 76 deletions .github/workflows/lambda-deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -641,79 +641,3 @@ jobs:
lambdaTimeout=10,
lambdaMemorySize=256,
cronExpression="rate(1 hour)"

deploy-likecoin-update-civic-liker-cache:
needs: build-lambda-image
runs-on: ubuntu-latest
steps:
- name: Checkout Repo
uses: actions/checkout@master

- name: Login to Amazon ECR
id: login-ecr
uses: aws-actions/amazon-ecr-login@v2

- name: Deploy Lambda
uses: aws-actions/aws-cloudformation-github-deploy@v1
with:
name: likecoin-update-civic-liker-cache-${{ inputs.environment }}
template: ./deployment/lambda/queuejob.yml
parameter-overrides: >-
mattersEnv=${{ env.MATTERS_ENV }},
imageUri=${{ steps.login-ecr.outputs.registry }}/${{ env.ECR_REPOSITORY }}:matters-server-${{ github.SHA }},
lambdaCMD=likecoinUpdateCivicLikerCache.handler,
lambdaTimeout=30,
lambdaMemorySize=512,
lambdaReservedConcurrency=200,
sqsArn=arn:aws:sqs:${{ secrets.AWS_REGION }}:${{ secrets.AWS_ACCOUNT_ID }}:likecoin-update-civic-liker-cache-${{ env.SQS_ENV }},
sqsBatchSize=100,
sqsMaxBatchingWindowInSeconds=1

deploy-likecoin-like:
needs: build-lambda-image
runs-on: ubuntu-latest
steps:
- name: Checkout Repo
uses: actions/checkout@master

- name: Login to Amazon ECR
id: login-ecr
uses: aws-actions/amazon-ecr-login@v2

- name: Deploy Lambda
uses: aws-actions/aws-cloudformation-github-deploy@v1
with:
name: likecoin-like-${{ inputs.environment }}
template: ./deployment/lambda/queuejob.yml
parameter-overrides: >-
mattersEnv=${{ env.MATTERS_ENV }},
imageUri=${{ steps.login-ecr.outputs.registry }}/${{ env.ECR_REPOSITORY }}:matters-server-${{ github.SHA }},
lambdaCMD=likecoinLike.handler,
lambdaTimeout=120,
lambdaMemorySize=512,
sqsArn=arn:aws:sqs:${{ secrets.AWS_REGION }}:${{ secrets.AWS_ACCOUNT_ID }}:likecoin-like-${{ env.SQS_ENV }}.fifo,
sqsBatchSize=10,
sqsMaxBatchingWindowInSeconds=0

deploy-likecoin-batch-update-civic-liker-caches:
needs: build-lambda-image
runs-on: ubuntu-latest
steps:
- name: Checkout Repo
uses: actions/checkout@master

- name: Login to Amazon ECR
id: login-ecr
uses: aws-actions/amazon-ecr-login@v2

- name: Deploy Lambda
uses: aws-actions/aws-cloudformation-github-deploy@v1
with:
name: likecoin-batch-update-civic-liker-caches-${{ inputs.environment }}
template: ./deployment/lambda/api.yml
parameter-overrides: >-
mattersEnv=${{ env.MATTERS_ENV }},
imageUri=${{ steps.login-ecr.outputs.registry }}/${{ env.ECR_REPOSITORY }}:matters-server-${{ github.SHA }},
lambdaCMD=likecoinBatchUpdateCivicLikerCaches.handler,
lambdaTimeout=20,
lambdaMemorySize=512
5 changes: 0 additions & 5 deletions src/common/enums/sqs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,6 @@ export const QUEUE_URL = {
// notification
notification: environment?.awsNotificationQueueUrl,

// likecoin
likecoinLike: environment?.awsLikecoinLikeUrl,
likecoinSendPV: environment?.awsLikecoinSendPVUrl,
likecoinUpdateCivicLikerCache: environment?.awsLikecoinUpdateCivicLikerCache,

// sendmail
mail: environment?.awsMailQueueUrl,
expressMail: environment?.awsExpressMailQueueUrl,
Expand Down
56 changes: 0 additions & 56 deletions src/connectors/__test__/likecoin.test.ts

This file was deleted.

52 changes: 0 additions & 52 deletions src/connectors/article/ipfsPublicationService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import type {
Connections,
ArticleVersion,
Article,
UserOAuthLikeCoin,
} from '#definitions/index.js'
import type { Knex } from 'knex'

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

import { AtomService } from '../atomService.js'
import { aws } from '../aws/index.js'
import { LikeCoin } from '../likecoin/index.js'

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

Expand All @@ -36,15 +34,13 @@ export class IPFSPublicationService {
private knexRO: Knex
private models: AtomService
private aws: typeof aws
private likecoin: LikeCoin

public constructor(connections: Connections) {
this.connections = connections
this.models = new AtomService(connections)
this.knex = connections.knex
this.knexRO = connections.knexRO
this.aws = aws
this.likecoin = new LikeCoin(connections)
}

private async initStorachaClient() {
Expand Down Expand Up @@ -352,54 +348,6 @@ export class IPFSPublicationService {
}
})

// publish to ISCN
try {
const draft = await this.models.findFirst({
table: 'draft',
where: { articleId },
})

if (article && draft && draft.iscnPublish) {
const author = await this.models.findFirst({
table: 'user',
where: { id: draft.authorId },
})

let liker: UserOAuthLikeCoin | undefined
if (author?.likerId) {
liker = await this.models.findFirst({
table: 'user_oauth_likecoin',
where: { likerId: author.likerId },
})
}

if (liker && author) {
const cosmosWallet = await this.likecoin.getCosmosWallet({ liker })

const { displayName, userName } = author
const iscnId = await this.likecoin.iscnPublish({
mediaHash: `hash://sha256/${mediaHash}`,
ipfsHash: `ipfs://${dataHash}`,
cosmosWallet,
userName: `${displayName} (@${userName})`,
title: articleVersion.title,
description: articleVersion.summary,
datePublished: article.createdAt?.toISOString().substring(0, 10),
url: `https://${environment.siteDomain}/a/${article.shortHash}`,
tags: articleVersion.tags,
liker,
})

await this.knex('article_version')
.where({ id: articleVersionId })
.update({ iscnId })
}
}
} catch (err) {
console.log('Failed to publish to ISCN')
console.error(err)
}

// invalidate cache
await invalidateFQC({
node: { type: NODE_TYPES.Article, id: articleId },
Expand Down
1 change: 0 additions & 1 deletion src/connectors/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ export * from './aws/index.js'
export * from './cache/index.js'
export * from './cloudflare/index.js'
export * from './mail/index.js'
export * from './likecoin/index.js'
export * from './opensea/index.js'
export * from './alchemy/index.js'
export * from './passphrases/index.js'
Expand Down
Loading