Merge branch 'ts-analytics' of https://github.com/linux-odyssey/linux-odyssey into ts-analytics

This commit is contained in:
chreamy committed 2024-03-05 01:27:10 -06:00
commit 94ae2d7df4
34 files changed
+291 -96

No files matched your search

+10 -4
View File
@@ -1,3 +1,9 @@
import dotenv from 'dotenv'
if (process.env.NODE_ENV !== 'production') {
dotenv.config({ path: '.env.dev' })
}
function getOrFailed(key: string): string {
if (!process.env[key]) {
throw new Error(`Missing required environment variable: ${key}`)
@@ -16,13 +22,13 @@ interface Config {
const config: Config = {
host: process.env.HOST || 'localhost',
port: process.env.PORT ? parseInt(process.env.PORT) : 3001,
port: process.env.PORT ? parseInt(process.env.PORT, 10) : 3001,
db: process.env.MONGO_URL || 'mongodb://localhost:27017/odyssey-test',
username: 'a' || getOrFailed('ADMIN_USERNAME'),
password: 'a' || getOrFailed('ADMIN_PASSWORD'),
username: getOrFailed('ADMIN_USERNAME'),
password: getOrFailed('ADMIN_PASSWORD'),
baseUrl:
process.env.BASE_URL ||
`http://${process.env.HOST || 'localhost'}:${process.env.PORT ? parseInt(process.env.PORT) : 3001}`,
`http://${process.env.HOST || 'localhost'}:${process.env.PORT ? parseInt(process.env.PORT, 10) : 3001}`,
}
export default config
+1 -1
View File
@@ -1,4 +1,4 @@
import { questList } from '../models/quests.ts'
import { questList } from '../models/quests.js'
// eslint-disable-next-line import/prefer-default-export
export async function questListController(req: any, res: any) {
const quests = await questList()
@@ -1,5 +1,10 @@
<<<<<<< HEAD
import Pagination from '../models/pagination.ts'
import { userList, userDetail, idToUser } from '../models/users.js'
=======
import Pagination from '../models/pagination.js'
import { userList } from '../models/users.js'
>>>>>>> bb4a11b20c8fdad8459ac3b7a0fdb8d9d9221e31
export async function userListController(req: any, res: any) {
const { nextKey, order } = req.query
@@ -20,6 +25,7 @@ export async function userListController(req: any, res: any) {
res.status(500).send('Error fetching user data')
}
}
<<<<<<< HEAD
export async function userDetailController(req: any, res: any) {
const { id } = req.params
const sessions = await userDetail(id)
@@ -31,3 +37,5 @@ export async function userDetailController(req: any, res: any) {
res.status(500).send('Error fetching user data')
}
}
=======
>>>>>>> bb4a11b20c8fdad8459ac3b7a0fdb8d9d9221e31