This commit is contained in:
syuilo 2018-03-28 15:54:47 +09:00
parent 69cef75b53
commit 02be56cfc0
3 changed files with 32 additions and 5 deletions

View file

@ -3,14 +3,14 @@ import deepcopy = require('deepcopy');
import db from '../../db/mongodb'; import db from '../../db/mongodb';
import { IUser, pack as packUser } from './user'; import { IUser, pack as packUser } from './user';
const Matching = db.get<IMatching>('othello_matchings'); const Matching = db.get<IMatching>('othelloMatchings');
export default Matching; export default Matching;
export interface IMatching { export interface IMatching {
_id: mongo.ObjectID; _id: mongo.ObjectID;
created_at: Date; createdAt: Date;
parent_id: mongo.ObjectID; parentId: mongo.ObjectID;
child_id: mongo.ObjectID; childId: mongo.ObjectID;
} }
/** /**

View file

@ -1,3 +1,13 @@
import * as mongo from 'mongodb';
import db from '../../db/mongodb'; import db from '../../db/mongodb';
export default db.get('poll_votes') as any; // fuck type definition const PollVote = db.get<IPollVote>('pollVotes');
export default PollVote;
export interface IPollVote {
_id: mongo.ObjectID;
createdAt: Date;
userId: mongo.ObjectID;
postId: mongo.ObjectID;
choice: number;
}

View file

@ -130,3 +130,20 @@ db.othelloGames.update({}, {
} }
}, false, true); }, false, true);
db.othello_matchings.renameCollection('othelloMatchings');
db.othelloMatchings.update({}, {
$rename: {
created_at: 'createdAt',
parent_id: 'parentId',
child_id: 'childId'
}
}, false, true);
db.poll_votes.renameCollection('pollVotes');
db.pollVotes.update({}, {
$rename: {
created_at: 'createdAt',
user_id: 'userId',
post_id: 'postId'
}
}, false, true);