Added: Beer API, Docs API and tests for both, fixed build
This commit is contained in:
34
api/src/models/Beer.ts
Normal file
34
api/src/models/Beer.ts
Normal file
@ -0,0 +1,34 @@
|
||||
import path from 'path';
|
||||
import { Schema, model } from 'mongoose';
|
||||
import { IBeer } from '../validators/beerValidator';
|
||||
|
||||
const schema = new Schema<IBeer | any>(
|
||||
{
|
||||
name: {
|
||||
type: String,
|
||||
required: true
|
||||
},
|
||||
degree: {
|
||||
type: Number,
|
||||
required: true
|
||||
},
|
||||
packaging: {
|
||||
type: String,
|
||||
required: true
|
||||
},
|
||||
brand: {
|
||||
type: String,
|
||||
required: true
|
||||
},
|
||||
imgs: {
|
||||
type: Array,
|
||||
required: false,
|
||||
default: []
|
||||
}
|
||||
},
|
||||
{
|
||||
timestamps: true
|
||||
}
|
||||
);
|
||||
|
||||
export default model(path.basename(__filename).split('.')[0], schema);
|
Reference in New Issue
Block a user