feat: removed console.logs

This commit is contained in:
2023-07-04 23:12:11 -03:00
parent 6971eeda3c
commit fe0cacf145
6 changed files with 9 additions and 23 deletions

View File

@@ -5,9 +5,8 @@ import dotenv from 'dotenv';
import dbConnection from './db';
import { publicProcedure, router } from './trpc';
import { User, UserSchema } from './schemas';
dotenv.config();
console.log(process.env);
dotenv.config();
const appRouter = router({
userById: publicProcedure.input(z.string()).query(async (opts) => {
@@ -37,5 +36,6 @@ dbConnection()
server.listen(3000);
})
.catch((e) => {
// eslint-disable-next-line no-console
console.log(e);
});

View File

@@ -1,31 +1,14 @@
import mongoose from 'mongoose';
export interface User {
id: string;
name: string;
}
// Imaginary database
const users: User[] = [];
export const db = {
user: {
create: async (data: { name: string }) => {
const user = { id: String(users.length + 1), ...data };
users.push(user);
return user;
},
findById: async (id: string) => users.find((user) => user.id === id),
findMany: async () => users,
},
};
export default async (): Promise<void> => {
await mongoose
.connect(process.env.MONGO_URI as string)
.then(() => {
// eslint-disable-next-line no-console
console.log('Connected to MongoDB');
})
.catch((error) => {
// eslint-disable-next-line no-console
console.error('Error connecting to MongoDB:', error);
});
};