Skip to content

Commit

Permalink
models: convert index.js to index.ts
Browse files Browse the repository at this point in the history
Also replace "require" with "import" and
"module.exports" with "export".
  • Loading branch information
Mersho committed Oct 6, 2023
1 parent c67fb63 commit 3dc8f98
Show file tree
Hide file tree
Showing 8 changed files with 21 additions and 22 deletions.
2 changes: 1 addition & 1 deletion models/community.ts
Original file line number Diff line number Diff line change
Expand Up @@ -82,4 +82,4 @@ const CommunitySchema = new Schema<ICommunity>({
});


module.exports = mongoose.model<ICommunity>('Community', CommunitySchema);
export default mongoose.model<ICommunity>('Community', CommunitySchema);
3 changes: 1 addition & 2 deletions models/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,4 @@ const configSchema = new Schema<IConfig>({
node_uri: { type: String },
});


module.exports = mongoose.model<IConfig>('Config', configSchema);
export default mongoose.model<IConfig>('Config', configSchema);
2 changes: 1 addition & 1 deletion models/dispute.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,4 +31,4 @@ const DisputeSchema = new Schema<IDispute>({
created_at: { type: Date, default: Date.now },
});

module.exports = mongoose.model<IDispute>('Dispute', DisputeSchema);
export default mongoose.model<IDispute>('Dispute', DisputeSchema);
15 changes: 0 additions & 15 deletions models/index.js

This file was deleted.

15 changes: 15 additions & 0 deletions models/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import User from './user'
import Order from './order'
import PendingPayment from './pending_payment'
import Community from './community'
import Dispute from './dispute'
import Config from './config'

export {
User,
Order,
PendingPayment,
Community,
Dispute,
Config,
};
2 changes: 1 addition & 1 deletion models/order.ts
Original file line number Diff line number Diff line change
Expand Up @@ -123,4 +123,4 @@ const orderSchema = new Schema<IOrder>({
is_public: { type: Boolean, default: true },
});

module.exports = mongoose.model<IOrder>('Order', orderSchema);
export default mongoose.model<IOrder>('Order', orderSchema);
2 changes: 1 addition & 1 deletion models/pending_payment.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,4 +40,4 @@ const PendingPaymentSchema = new Schema<IPendingPayment>({
});


module.exports = mongoose.model<IPendingPayment>('PendingPayment', PendingPaymentSchema);
export default mongoose.model<IPendingPayment>('PendingPayment', PendingPaymentSchema);
2 changes: 1 addition & 1 deletion models/user.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,4 +52,4 @@ const UserSchema = new Schema<UserDocument>({
default_community_id: { type: String },
});

module.exports = mongoose.model<UserDocument>('User', UserSchema);
export default mongoose.model<UserDocument>('User', UserSchema);

0 comments on commit 3dc8f98

Please sign in to comment.