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
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM node:12-alpine
FROM node:14-alpine

RUN apk --no-cache add curl

Expand Down
19 changes: 12 additions & 7 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@
"scripts": {
"docker:build": "docker build --cpuset-cpus 2 -t hsldevcom/transitlog-server .",
"docker:run": "docker run --name transitlog-server -p 4000:4000 hsldevcom/transitlog-server",
"start": "TS_NODE_FILES=true NODE_ICU_DATA=\\\"node_modules/full-icu\\\" ts-node-dev --max-old-space-size=4096 --no-notify --respawn --inspect -r dotenv/config --files src/server.ts",
"start:build": "TS_NODE_FILES=true NODE_ICU_DATA=\"node_modules/full-icu\" ts-node-dev --no-notify --respawn --inspect -r dotenv/config --files dist/server.js",
"start:production": "NODE_ICU_DATA=\"node_modules/full-icu\" forever stopall && forever start -f --spinSleepTime 1000 -c \"node -r dotenv/config\" dist/server.js && sleep 10 && forever logs -f 0",
"start": "TS_NODE_FILES=true ts-node-dev --max-old-space-size=4096 --no-notify --respawn --inspect -r dotenv/config --files src/server.ts",
"start:build": "TS_NODE_FILES=true ts-node-dev --no-notify --respawn --inspect -r dotenv/config --files dist/server.js",
"start:production": "forever stopall && forever start -f --spinSleepTime 1000 -c \"node -r dotenv/config\" dist/server.js && sleep 10 && forever logs -f 0",
"build": "tsc",
"codegen": "graphql-codegen --config codegen.yml",
"codestyle": "prettier \"src/**/*.{ts,js,json}\" --write",
Expand All @@ -33,17 +33,17 @@
"author": "HSLdevcom",
"license": "MIT",
"dependencies": {
"@azure/storage-blob": "^12.1.1",
"@azure/storage-blob": "^12.6.0",
"@slack/web-api": "^5.8.0",
"apollo-datasource": "^0.3.1",
"apollo-link": "^1.2.9",
"apollo-link-context": "^1.0.15",
"apollo-link-error": "^1.1.8",
"apollo-link-http": "^1.5.12",
"apollo-server": "^2.4.8",
"apollo-server": "^2.25.2",
"apollo-server-caching": "^0.3.1",
"apollo-server-errors": "^2.2.1",
"apollo-server-express": "^2.4.8",
"apollo-server-express": "^2.25.2",
"await-to-js": "^2.1.1",
"body-parser": "^1.18.3",
"boundingbox": "^1.2.0",
Expand All @@ -60,7 +60,8 @@
"fs-extra": "^8.0.1",
"full-icu": "^1.3.0",
"fuse.js": "^3.4.4",
"graphql": "^14.1.1",
"graphql": "^15.5.1",
"graphql-upload": "^11.0.0",
"ioredis": "^4.16.0",
"isomorphic-fetch": "^2.2.1",
"knex": "^0.95.6",
Expand Down Expand Up @@ -103,5 +104,9 @@
"tslint": "^6.1.3",
"tslint-config-prettier": "^1.18.0",
"tslint-plugin-prettier": "^2.0.1"
},
"resolutions": {
"graphql-upload": "^11.0.0",
"fs-capacitor": "^6.2.0"
}
}
8 changes: 7 additions & 1 deletion src/resolvers/mutationResolvers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import {
SLACK_TOKEN_FEEDBACK,
} from './../constants'
import { ApolloError } from 'apollo-server'
import { ReadStream } from 'fs'

const slack = new WebClient(SLACK_TOKEN_FEEDBACK)

Expand All @@ -24,6 +25,7 @@ export const mutationResolvers = {
const { text, email, url } = args
const fromStr = email !== '' ? email.trim() : 'anonymous user'
const feedbackRes: any = await slack.chat.postMessage({
// TODO: Move this to env
channel: 'C010S7YF98E',
text: '*' + fromStr + '*\n\n' + text.trim(),
})
Expand All @@ -41,12 +43,16 @@ export const mutationResolvers = {
if (isImageFile(mimetype)) {
// upload image to azure blob
const blobName = uuidv4() + '.' + filename.split('.').pop()

const blobServiceClient = await BlobServiceClient.fromConnectionString(
AZURE_FEEDBACK_BLOB_CONN
)

const container = blobServiceClient.getContainerClient('feedback-images')
const blockBlob = container.getBlockBlobClient(blobName)
blockBlob.uploadStream(createReadStream())
const imageStream: ReadStream = createReadStream()

await blockBlob.uploadStream(imageStream, imageStream.readableHighWaterMark)

const downloadUrl =
'https://feedbackfiles.blob.core.windows.net/feedback-images/' +
Expand Down
Loading