Skip to content

Commit

Permalink
💀 Write for service arquitecture api
Browse files Browse the repository at this point in the history
  • Loading branch information
delirial committed Aug 1, 2019
1 parent 7a6ee15 commit 671e795
Show file tree
Hide file tree
Showing 29 changed files with 536 additions and 69 deletions.
25 changes: 0 additions & 25 deletions app.js

This file was deleted.

204 changes: 167 additions & 37 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

16 changes: 9 additions & 7 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,24 +22,26 @@
"express": "^4.17.1",
"express-handlebars": "^3.1.0",
"mariadb": "^2.1.0",
"mongoose": "^5.6.7",
"sequelize": "^5.10.3"
},
"devDependencies": {
"typescript": "^3.5.2",
"eslint": "^6.0.1",
"eslint-config-prettier": "^6.0.0",
"eslint-plugin-jest": "^22.7.2",
"eslint-plugin-prettier": "^3.1.0",
"@types/body-parser": "^1.17.0",
"@types/express": "^4.17.0",
"@types/jest": "^24.0.15",
"@types/node": "^12.0.12",
"@types/mongoose": "^5.5.11",
"@types/node": "^12.6.8",
"@typescript-eslint/eslint-plugin": "^1.11.0",
"@typescript-eslint/parser": "^1.11.0",
"eslint": "^6.0.1",
"eslint-config-prettier": "^6.0.0",
"eslint-plugin-jest": "^22.7.2",
"eslint-plugin-prettier": "^3.1.0",
"jest": "^24.8.0",
"nodemon": "^1.19.1",
"prettier": "^1.18.2",
"ts-jest": "^24.0.2",
"ts-node": "^8.3.0",
"nodemon": "^1.19.1"
"typescript": "^3.5.2"
}
}
18 changes: 18 additions & 0 deletions src/api/data/mongodb/ActivityModel.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import { Document, Model, model, Schema } from 'mongoose';
import { ActivityDTO } from '../../../types/ActivityDTO';

export interface ActivityModel extends ActivityDTO, Document {
getTitleAndYear(): string;
}
export const ActivitySchema: Schema = new Schema({
title: String,
year: Number,
genre: [String],
duration: Number,
});

ActivitySchema.methods.getTitleAndYear = function(): string {
return this.title + ' ' + this.duration;
};

export const Activity: Model<ActivityModel> = model<ActivityModel>('movies', ActivitySchema);
Loading

0 comments on commit 671e795

Please sign in to comment.