Skip to content

Commit fd03f26

Browse files
committed
refactor: rename interfaces
1 parent 57275be commit fd03f26

File tree

4 files changed

+8
-9
lines changed

4 files changed

+8
-9
lines changed

models/polls/poll.model.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { Model, model } from "mongoose"
2-
import { Poll, PollSchema } from './poll.schema';
2+
import { PollSchema, pollSchema } from './poll.schema';
33

4-
export default model<Poll, Model<Poll>>("Poll", PollSchema);
4+
export default model<PollSchema, Model<PollSchema>>("Poll", pollSchema);
55

models/polls/poll.schema.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,11 @@
11
import { Document, Schema, Types } from 'mongoose';
2-
import { User } from '../users/user.schema';
32

43
interface ImageData {
54
url: string;
65
votes: number;
76
}
87

9-
export interface Poll extends Document {
8+
export interface PollSchema extends Document {
109
authorId: string;
1110
contents: {
1211
left: ImageData;
@@ -20,7 +19,7 @@ const imageDataSchema = {
2019
votes: Number
2120
}
2221

23-
export const PollSchema = new Schema({
22+
export const pollSchema = new Schema({
2423
contents: {
2524
left: imageDataSchema,
2625
right: imageDataSchema

models/users/user.model.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { Model, model } from "mongoose"
2-
import { User, UserSchema } from './user.schema';
2+
import { UserSchema, userSchema } from './user.schema';
33

4-
export default model<User, Model<User>>("User", UserSchema);
4+
export default model<UserSchema, Model<UserSchema>>("User", userSchema);
55

models/users/user.schema.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
import { Document, Schema } from "mongoose"
22

3-
export interface User extends Document {
3+
export interface UserSchema extends Document {
44
name: string;
55
avatarUrl?: string;
66
age?: number;
77
}
88

9-
export const UserSchema = new Schema({
9+
export const userSchema = new Schema({
1010
name: String,
1111
avatarUrl: {
1212
type: String,

0 commit comments

Comments
 (0)