mirror of
https://github.com/tomru/pfadi-bussle.git
synced 2026-03-04 23:17:12 +01:00
update mongoose to 5.8.3 (lots of types changes)
This commit is contained in:
17
db/bill.ts
17
db/bill.ts
@@ -2,27 +2,30 @@ import * as mongoose from 'mongoose'
|
||||
import { BILL_STATUS, MILAGE_TARIFS } from './enums'
|
||||
import { getBillTotal } from '../helpers/bill'
|
||||
|
||||
export type AdditionalCost = {
|
||||
export interface IAdditionalCost {
|
||||
name: string
|
||||
value: number
|
||||
}
|
||||
|
||||
export type Bill = {
|
||||
export interface IBill {
|
||||
milageStart: number
|
||||
milageEnd: number
|
||||
milage?: number
|
||||
tarif: MILAGE_TARIFS
|
||||
status: BILL_STATUS
|
||||
additionalCosts: AdditionalCost[]
|
||||
additionalCosts: IAdditionalCost[]
|
||||
|
||||
createdAt?: string
|
||||
updatedAt?: string
|
||||
}
|
||||
|
||||
export type BillDocument = Bill &
|
||||
export type BillDocument = IBill &
|
||||
mongoose.SchemaTimestampsConfig &
|
||||
mongoose.Document
|
||||
|
||||
export type BillModel = mongoose.Model<BillDocument>
|
||||
export type BillModel = mongoose.Model<IBill>
|
||||
|
||||
const BillSchema = new mongoose.Schema<BillDocument>(
|
||||
const BillSchema = new mongoose.Schema<IBill>(
|
||||
{
|
||||
milageStart: {
|
||||
type: Number,
|
||||
@@ -88,4 +91,4 @@ BillSchema.virtual('total').get(function (): number {
|
||||
})
|
||||
|
||||
export default (mongoose.models.Bill ||
|
||||
mongoose.model<BillDocument, BillModel>('Bill', BillSchema)) as BillModel
|
||||
mongoose.model<BillDocument, BillModel>('Bill', BillSchema)) as BillModel
|
||||
Reference in New Issue
Block a user