Skip to content

Commit

Permalink
fix: Mr Sweet builds
Browse files Browse the repository at this point in the history
  • Loading branch information
JonatanMGit committed Apr 18, 2023
1 parent a54cd92 commit aa5f2b8
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 5 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/tsc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,4 @@ jobs:
- name: install dependencies
run: npm install
- name: Build
run: npm run build
run: npm run build:bot
3 changes: 2 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,10 @@
FROM node:19.5.0-alpine as build
WORKDIR /app
COPY package*.json ./
COPY bot/package*.json ./bot/
RUN npm install
COPY . .
RUN cd ./bot && npm run build
RUN npm run build:bot
RUN npm prune --production


Expand Down
13 changes: 11 additions & 2 deletions bot/src/userData.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ const express = require('express');
// const fetch = require('node-fetch');
// you can fix this by using import instead of require
import axios from 'axios';
import { User } from './db';

// import User from './db.js';
import { saveUser, getUser } from './db';
Expand Down Expand Up @@ -51,7 +52,11 @@ app.get('/discord-oauth-callback', (req, res) => {
}).then(res => {
// console.log(res.data.id);
// add user to database
saveUser(res.data.id, refresh_token)
const user = new User({
id: res.data.id,
refresh_token: refresh_token,
});
saveUser(user);
});
});
res.redirect("/dashboard");
Expand Down Expand Up @@ -82,7 +87,11 @@ export const getAccessToken = async (userID, refresh_token) => {
}
});
// save the new refresh token
saveUser(userID, res.data.refresh_token);
const user = new User({
id: res.data.id,
refresh_token: res.data.refresh_token,
});
saveUser(user);
return res.data.access_token;
}

Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
"sqlite3": "^5.1.6"
},
"scripts": {
"build": "cd bot && npm run build && cd ../web",
"build:bot": "cd bot && npm run build",
"setup:bot": "npm install && cd bot && npm install && npm run build",
"start:bot": "cd bot && npm start"
},
Expand Down

0 comments on commit aa5f2b8

Please sign in to comment.