Skip to content

Commit

Permalink
dispute: convert js to ts
Browse files Browse the repository at this point in the history
Create a dispute.ts model from the dispute.js model.
  • Loading branch information
Mersho committed Sep 4, 2023
1 parent f68c4ef commit 33221b4
Showing 1 changed file with 14 additions and 3 deletions.
17 changes: 14 additions & 3 deletions models/dispute.js → models/dispute.ts
Original file line number Diff line number Diff line change
@@ -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<IDispute>({
initiator: { type: String, required: true },
seller_id: { type: String },
buyer_id: { type: String },
Expand All @@ -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<IDispute>('Dispute', DisputeSchema);

0 comments on commit 33221b4

Please sign in to comment.