Skip to content

Commit a3fc669

Browse files
authored
Merge pull request #32 from oslabs-beta/cleanup
Removed user model from items service
2 parents b5c5771 + 7877d31 commit a3fc669

File tree

3 files changed

+1
-59
lines changed

3 files changed

+1
-59
lines changed

examples_new/microservices/items/src/controllers/itemController.ts

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,14 @@
11
import { Response } from 'express';
22
import axios, { AxiosError } from 'axios';
3-
import {
4-
BadRequestError,
5-
CurrentUserRequest,
6-
EventTypes,
7-
NotAuthorizedError,
8-
} from '@chronosrx/common';
3+
import { BadRequestError, CurrentUserRequest, EventTypes } from '@chronosrx/common';
94
import { Item } from '../models/items';
105

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

19-
// new item is created with the build method and then saved
2012
const newItem = Item.build({
2113
itemName,
2214
});

examples_new/microservices/items/src/index.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ import mongoose from 'mongoose';
33
import { app } from './app';
44
import { DbConnectionError } from '@chronosrx/common';
55
import { Item } from './models/items';
6-
import { User } from './models/users';
76
import dotenv from 'dotenv';
87
dotenv.config({ path: path.resolve(__dirname + '../../.env') });
98

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

2120
// reset DB's
22-
await User.deleteMany();
2321
await Item.deleteMany();
2422
} catch (err) {
2523
throw new DbConnectionError();

examples_new/microservices/items/src/models/users.ts

Lines changed: 0 additions & 48 deletions
This file was deleted.

0 commit comments

Comments
 (0)