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 505e2d6 commit f0dd116
Showing 1 changed file with 34 additions and 0 deletions.
34 changes: 34 additions & 0 deletions models/dispute.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
import mongoose, { Document, Schema } from 'mongoose';

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 },
status: {
type: String,
enum: [
'WAITING_FOR_SOLVER',
'IN_PROGRESS', // taken by a solver
'SETTLED', // settled seller's invoice by admin/solver and started to pay sats to buyer
'SELLER_REFUNDED', // canceled by admin/solver and refunded to seller
'RELEASED', // release by the seller
],
},
community_id: { type: String, default: null },
order_id: { type: String, default: null },
solver_id: { type: String, default: null },
created_at: { type: Date, default: Date.now },
});

module.exports = mongoose.model<IDispute>('Dispute', DisputeSchema);

0 comments on commit f0dd116

Please sign in to comment.