Skip to content

Commit

Permalink
Merge pull request #32 from oslabs-beta/cleanup
Browse files Browse the repository at this point in the history
Removed user model from items service
  • Loading branch information
seantokuzo authored Jan 10, 2024
2 parents b5c5771 + 7877d31 commit a3fc669
Show file tree
Hide file tree
Showing 3 changed files with 1 addition and 59 deletions.
Original file line number Diff line number Diff line change
@@ -1,22 +1,14 @@
import { Response } from 'express';
import axios, { AxiosError } from 'axios';
import {
BadRequestError,
CurrentUserRequest,
EventTypes,
NotAuthorizedError,
} from '@chronosrx/common';
import { BadRequestError, CurrentUserRequest, EventTypes } from '@chronosrx/common';
import { Item } from '../models/items';

// current users can create items to sell
export const createItem = async (req: CurrentUserRequest, res: Response) => {
// req.body consists of itemName and unitPrice
const { itemName } = req.body;
if (!itemName) {
throw new BadRequestError('Invalid inputs');
}

// new item is created with the build method and then saved
const newItem = Item.build({
itemName,
});
Expand Down
2 changes: 0 additions & 2 deletions examples_new/microservices/items/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ import mongoose from 'mongoose';
import { app } from './app';
import { DbConnectionError } from '@chronosrx/common';
import { Item } from './models/items';
import { User } from './models/users';
import dotenv from 'dotenv';
dotenv.config({ path: path.resolve(__dirname + '../../.env') });

Expand All @@ -19,7 +18,6 @@ const start = async () => {
console.log('🍃 Connected to MongoDB');

// reset DB's
await User.deleteMany();
await Item.deleteMany();
} catch (err) {
throw new DbConnectionError();
Expand Down
48 changes: 0 additions & 48 deletions examples_new/microservices/items/src/models/users.ts

This file was deleted.

0 comments on commit a3fc669

Please sign in to comment.