From 63688ab3a9bf2c2f1939b3177d60b6acc8e45b87 Mon Sep 17 00:00:00 2001 From: Mehrshad Date: Wed, 30 Aug 2023 17:16:43 +0330 Subject: [PATCH] dispute: convert js to ts Create a dispute.ts model from the dispute.js model. --- models/{dispute.js => dispute.ts} | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) rename models/{dispute.js => dispute.ts} (62%) diff --git a/models/dispute.js b/models/dispute.ts similarity index 62% rename from models/dispute.js rename to models/dispute.ts index c87f9692..381a17e2 100644 --- a/models/dispute.js +++ b/models/dispute.ts @@ -1,6 +1,17 @@ -const mongoose = require('mongoose'); +import mongoose, { Document, Schema } from 'mongoose'; -const DisputeSchema = new mongoose.Schema({ +export interface IDispute extends Document { + initiator: string; + seller_id: string; + buyer_id: string; + status: string; + community_id: string; + order_id: string; + solver_id: string; + created_at: Date; +} + +const DisputeSchema = new Schema({ initiator: { type: String, required: true }, seller_id: { type: String }, buyer_id: { type: String }, @@ -20,4 +31,4 @@ const DisputeSchema = new mongoose.Schema({ created_at: { type: Date, default: Date.now }, }); -module.exports = mongoose.model('Dispute', DisputeSchema); +module.exports = mongoose.model('Dispute', DisputeSchema);