-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(back): Twitter first reaction: post a tweet
- Loading branch information
1 parent
0cca709
commit bbdf6c9
Showing
23 changed files
with
2,869 additions
and
47 deletions.
There are no files selected for viewing
46 changes: 0 additions & 46 deletions
46
backend/back/1699107944021-CreateAirtableDeleteRecordReaction.ts
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
44 changes: 44 additions & 0 deletions
44
backend/back/src/workflows/seed/1699107944021-CreateAirtableDeleteRecordReaction.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
import { MigrationInterface, QueryRunner } from "typeorm"; | ||
import { ParametersFormFlowFieldDto } from "../../services/dto/area.dto"; | ||
|
||
export class CreateAirtableDeleteRecordReaction1699107944021 implements MigrationInterface { | ||
private readonly airtableDeleteRecordParametersFormFlow: ParametersFormFlowFieldDto[] = [ | ||
{ | ||
name: "baseId", | ||
type: "short-text", | ||
required: true, | ||
}, | ||
{ | ||
name: "tableId", | ||
type: "short-text", | ||
required: true, | ||
}, | ||
{ | ||
name: "recordId", | ||
type: "short-text", | ||
required: true, | ||
}, | ||
]; | ||
|
||
public async up(queryRunner: QueryRunner): Promise<void> { | ||
await queryRunner.query( | ||
`INSERT INTO "area" ("id", "service_id", "is_action", "description", "parameters_form_flow", "parameters_return_flow") | ||
VALUES ('delete-record', 'airtable', false, 'Delete a record from an Airtable base table', $1, '{}')`, | ||
[JSON.stringify(this.airtableDeleteRecordParametersFormFlow)], | ||
); | ||
|
||
await queryRunner.query( | ||
`INSERT INTO "area_service_scopes_needed_service_scope" ("area_id", "area_service_id", "service_scope_id", "service_scope_service_id") | ||
VALUES ('delete-record', 'airtable', 'data.records:write', 'airtable')`, | ||
); | ||
} | ||
|
||
public async down(queryRunner: QueryRunner): Promise<void> { | ||
await queryRunner.query( | ||
`DELETE FROM "area" | ||
WHERE service_id = 'airtable' | ||
AND id IN ('delete-record'); | ||
`, | ||
); | ||
} | ||
} |
36 changes: 36 additions & 0 deletions
36
backend/back/src/workflows/seed/1699115775099-CreateTwitterCreateTweetReaction.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
import { MigrationInterface, QueryRunner } from "typeorm"; | ||
import { ParametersFormFlowFieldDto } from "../../services/dto/area.dto"; | ||
|
||
export class CreateTwitterCreateTweetReaction1699115775099 implements MigrationInterface { | ||
private readonly twitterCreateTweetParametersFormFlow: ParametersFormFlowFieldDto[] = [ | ||
{ | ||
name: "text", | ||
type: "long-text", | ||
required: true, | ||
}, | ||
]; | ||
|
||
public async up(queryRunner: QueryRunner): Promise<void> { | ||
await queryRunner.query( | ||
`INSERT INTO "area" ("id", "service_id", "is_action", "description", "parameters_form_flow", "parameters_return_flow") | ||
VALUES ('create-tweet', 'twitter', false, 'Post a tweet on Twitter (X)', $1, '{}')`, | ||
[JSON.stringify(this.twitterCreateTweetParametersFormFlow)], | ||
); | ||
|
||
await queryRunner.query( | ||
`INSERT INTO "area_service_scopes_needed_service_scope" ("area_id", "area_service_id", "service_scope_id", "service_scope_service_id") | ||
VALUES ('create-tweet', 'twitter', 'tweet.read', 'twitter'), | ||
('create-tweet', 'twitter', 'tweet.write', 'twitter'), | ||
('create-tweet', 'twitter', 'users.read', 'twitter')`, | ||
); | ||
} | ||
|
||
public async down(queryRunner: QueryRunner): Promise<void> { | ||
await queryRunner.query( | ||
`DELETE FROM "area" | ||
WHERE service_id = 'twitter' | ||
AND id IN ('create-tweet'); | ||
`, | ||
); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
dist/ | ||
node_modules/ | ||
proto/ | ||
.env |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
env: | ||
browser: true | ||
es2022: true | ||
|
||
extends: | ||
- airbnb-base | ||
- airbnb-typescript/base | ||
- plugin:@typescript-eslint/recommended | ||
- plugin:prettier/recommended | ||
|
||
parser: '@typescript-eslint/parser' | ||
|
||
parserOptions: | ||
project: tsconfig.json | ||
ecmaVersion: latest | ||
sourceType: module | ||
|
||
rules: | ||
no-plusplus: ["error", { "allowForLoopAfterthoughts": true }] | ||
no-console: off | ||
"@typescript-eslint/no-non-null-assertion": off |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,104 @@ | ||
# Logs | ||
logs | ||
*.log | ||
npm-debug.log* | ||
yarn-debug.log* | ||
yarn-error.log* | ||
lerna-debug.log* | ||
|
||
# Diagnostic reports (https://nodejs.org/api/report.html) | ||
report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json | ||
|
||
# Runtime data | ||
pids | ||
*.pid | ||
*.seed | ||
*.pid.lock | ||
|
||
# Directory for instrumented libs generated by jscoverage/JSCover | ||
lib-cov | ||
|
||
# Coverage directory used by tools like istanbul | ||
coverage | ||
*.lcov | ||
|
||
# nyc test coverage | ||
.nyc_output | ||
|
||
# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files) | ||
.grunt | ||
|
||
# Bower dependency directory (https://bower.io/) | ||
bower_components | ||
|
||
# node-waf configuration | ||
.lock-wscript | ||
|
||
# Compiled binary addons (https://nodejs.org/api/addons.html) | ||
build/Release | ||
|
||
# Dependency directories | ||
node_modules/ | ||
jspm_packages/ | ||
|
||
# TypeScript v1 declaration files | ||
typings/ | ||
|
||
# TypeScript cache | ||
*.tsbuildinfo | ||
|
||
# Optional npm cache directory | ||
.npm | ||
|
||
# Optional eslint cache | ||
.eslintcache | ||
|
||
# Microbundle cache | ||
.rpt2_cache/ | ||
.rts2_cache_cjs/ | ||
.rts2_cache_es/ | ||
.rts2_cache_umd/ | ||
|
||
# Optional REPL history | ||
.node_repl_history | ||
|
||
# Output of 'npm pack' | ||
*.tgz | ||
|
||
# Yarn Integrity file | ||
.yarn-integrity | ||
|
||
# dotenv environment variables file | ||
.env | ||
.env.test | ||
|
||
# parcel-bundler cache (https://parceljs.org/) | ||
.cache | ||
|
||
# Next.js build output | ||
.next | ||
|
||
# Nuxt.js build / generate output | ||
.nuxt | ||
dist | ||
|
||
# Gatsby files | ||
.cache/ | ||
# Comment in the public line in if your project uses Gatsby and *not* Next.js | ||
# https://nextjs.org/blog/next-9-1#public-directory-support | ||
# public | ||
|
||
# vuepress build output | ||
.vuepress/dist | ||
|
||
# Serverless directories | ||
.serverless/ | ||
|
||
# FuseBox cache | ||
.fusebox/ | ||
|
||
# DynamoDB Local files | ||
.dynamodb/ | ||
|
||
# TernJS port file | ||
.tern-port |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
printWidth: 120 # Specify the line length that the printer will wrap on | ||
tabWidth: 2 # Specify the number of spaces per indentation-level | ||
useTabs: true # Indent lines with tabs instead of spaces | ||
semi: true # Print semicolons at the ends of statements | ||
bracketSpacing: true # Print spaces between brackets in object literals | ||
parser: typescript # Specify which parser to use |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
FROM node:18.18.0-alpine3.18 AS builder | ||
|
||
# Create app directory | ||
WORKDIR /app | ||
|
||
# Copy dependencies files | ||
COPY package.json yarn.lock ./ | ||
|
||
# Install dependencies | ||
RUN yarn install --frozen-lockfile --ignore-scripts | ||
|
||
# Get protobuf files | ||
RUN apk add git protobuf protobuf-dev | ||
RUN git clone https://github.com/RezaRahemtola/area-proto.git proto | ||
RUN mkdir -p ./src/proto ; protoc --plugin=$(npm root)/.bin/protoc-gen-ts_proto --ts_proto_out=src/proto --ts_proto_opt=outputServices=grpc-js --ts_proto_opt=esModuleInterop=true -I=proto/ proto/area_back.proto proto/area_types.proto | ||
|
||
# Copy source (see .dockerignore) | ||
COPY . . | ||
|
||
# Build | ||
RUN yarn build | ||
|
||
FROM node:18.18.0-alpine3.18 AS runner | ||
|
||
WORKDIR /app | ||
|
||
# Non-root user | ||
RUN addgroup -S user \ | ||
&& adduser -S user -G user | ||
RUN chown -R user:user /app | ||
USER user | ||
|
||
COPY --from=builder /app/dist ./ | ||
COPY --from=builder /app/node_modules ./node_modules | ||
COPY --from=builder /app/package.json ./package.json | ||
|
||
ENTRYPOINT ["node", "--experimental-specifier-resolution=node", "main.js"] |
Oops, something went wrong.