-
-
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.
Merge pull request #1 from austenstone/webhooks
Webhooks
- Loading branch information
Showing
45 changed files
with
2,026 additions
and
601 deletions.
There are no files selected for viewing
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,27 @@ | ||
name: Backend | ||
|
||
on: | ||
push: | ||
paths: | ||
- 'backend/**/*' | ||
branches: | ||
- main | ||
pull_request: | ||
paths: | ||
- 'backend/**/*' | ||
branches: | ||
- main | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- uses: actions/checkout@v3 | ||
- uses: actions/setup-node@v3 | ||
with: | ||
node-version: '20' | ||
- run: npm ci | ||
working-directory: ./backend | ||
- run: npm run build | ||
working-directory: ./backend |
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,17 @@ | ||
name: Compose | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
pull_request: | ||
branches: | ||
- main | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- uses: actions/checkout@v3 | ||
- run: docker compose build |
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,27 @@ | ||
name: Frontend | ||
|
||
on: | ||
push: | ||
paths: | ||
- 'frontend/**/*' | ||
branches: | ||
- main | ||
pull_request: | ||
paths: | ||
- 'frontend/**/*' | ||
branches: | ||
- main | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- uses: actions/checkout@v3 | ||
- uses: actions/setup-node@v3 | ||
with: | ||
node-version: '20' | ||
- run: npm ci | ||
working-directory: ./frontend | ||
- run: npm run build | ||
working-directory: ./frontend |
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,41 @@ | ||
# Databse configuration | ||
MYSQL_HOST=db | ||
MYSQL_PORT=3306 | ||
MYSQL_ROOT_PASSWORD=octocat | ||
MYSQL_DATABASE=value | ||
|
||
# Base URL for the web server | ||
WEB_URL=http://localhost | ||
|
||
# GitHub App configuration | ||
GITHUB_WEBHOOK_SECRET=bananas | ||
GITHUB_APP_ID=1028384 | ||
GITHUB_APP_CLIENT_ID=Iv23ctKxsNlsTbAt3NJY | ||
GITHUB_APP_CLIENT_SECRET=84a0d7dff1a75f0d121b9acb7d3854c1ed53420d | ||
GITHUB_APP_PRIVATE_KEY="-----BEGIN RSA PRIVATE KEY----- | ||
MIIEowIBAAKCAQEAtOMefP+H3nYFZcEyAI2BWp4lAj+aQt4I32/TA2hNcd7n4Jtv | ||
LpW2ioAm0Bw9fndDwMTiYPQj8lH1E+Yd85lYQoQqtQcu3g21upcBHxvd1Au9I7ea | ||
sfrnYOYE+LywR7rOEROwlUJwiU+D4d7CtRPt6DDzZH+w6DCBsBMi7Q1l3VkLXZy/ | ||
Jy8ZikwaM2sCBnMtGeIlbiCGKwle8ypqqdnhwbxXumzS4sGqRMTrUtfZA6B6Hikb | ||
GYKNRRjjuWIk4dVVz5Vs5mmANSaLqHp9FeN+T5HrPUt5CYZ0qvuDeK824+9k36LL | ||
3fiVVWltv8YLoaZZtWkH1CxnM0PWliCIZdLMDQIDAQABAoIBAGrTdr37axJGQQnG | ||
/vC0oSATJWgeh8vVtQe/0q7Aenw1WFudcBvi7tr8s+9Tvj1h0fGWVNtNU61YGZSW | ||
4jlq5mTiC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zXrIwAggGFr1RBRBlS2V+H0zGHx0VCc0b0dpi/6CfR04KQCwn6HNH | ||
qUizWCdkEq/3I8PMZd4TrAam9hlWymvPzQIttsh0ElnKAtZMJEv0 | ||
-----END RSA PRIVATE KEY-----" |
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 |
---|---|---|
@@ -1 +1,2 @@ | ||
node_modules | ||
node_modules | ||
dist/ |
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,48 @@ | ||
import 'dotenv/config' | ||
import { Sequelize } from 'sequelize'; | ||
import Survey from '../src/models/survey.model' | ||
import sequelize from '../src/database'; | ||
|
||
beforeAll(async () => { | ||
try { | ||
await sequelize.authenticate(); | ||
console.log('Connection has been established successfully.'); | ||
} catch (error) { | ||
console.error('Unable to connect to the database:', error); | ||
} | ||
await sequelize.sync({ force: true }); // Recreate the database schema | ||
}); | ||
|
||
afterAll(async () => { | ||
await sequelize.close(); | ||
}); | ||
|
||
describe('Survey Model', () => { | ||
it('should create a survey with valid data', async () => { | ||
const survey = await Survey.create({ | ||
daytime: new Date(), | ||
userId: 1044, | ||
usedCopilot: true, | ||
pctTimesaved: 50, | ||
timeUsedFor: 'Releases', | ||
}); | ||
|
||
expect(survey).toBeDefined(); | ||
expect(survey.userId).toBe(1044); | ||
expect(survey.usedCopilot).toBe(true); | ||
expect(survey.pctTimesaved).toBe(50); | ||
expect(survey.timeUsedFor).toBe('Releases'); | ||
}); | ||
|
||
it('should calculate timeSaved correctly', async () => { | ||
const survey = await Survey.create({ | ||
daytime: new Date(), | ||
userId: 1044, | ||
usedCopilot: true, | ||
pctTimesaved: 50, | ||
timeUsedFor: 'Releases', | ||
}); | ||
|
||
expect(survey.timeSaved).toBe('50% saved for Releases'); | ||
}); | ||
}); |
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,8 @@ | ||
module.exports = { | ||
preset: 'ts-jest', | ||
testEnvironment: 'node', | ||
transform: { | ||
'^.+\\.tsx?$': 'ts-jest', | ||
}, | ||
moduleFileExtensions: ['ts', 'tsx', 'js', 'jsx', 'json', 'node'], | ||
}; |
Oops, something went wrong.