diff options
| author | syuilo <syuilotan@yahoo.co.jp> | 2017-09-08 04:13:01 +0900 |
|---|---|---|
| committer | syuilo <syuilotan@yahoo.co.jp> | 2017-09-08 04:13:01 +0900 |
| commit | 3feeaccf5955ebf17c26ccc06f32bb39624b89f6 (patch) | |
| tree | fa5d7ee54ba77dcc76ff3cae1d6791dcae499f92 /src/api/models/user.ts | |
| parent | wip dark (diff) | |
| download | sharkey-3feeaccf5955ebf17c26ccc06f32bb39624b89f6.tar.gz sharkey-3feeaccf5955ebf17c26ccc06f32bb39624b89f6.tar.bz2 sharkey-3feeaccf5955ebf17c26ccc06f32bb39624b89f6.zip | |
Add type definition
Diffstat (limited to 'src/api/models/user.ts')
| -rw-r--r-- | src/api/models/user.ts | 40 |
1 files changed, 38 insertions, 2 deletions
diff --git a/src/api/models/user.ts b/src/api/models/user.ts index 9f8cf0161d..1591b339bc 100644 --- a/src/api/models/user.ts +++ b/src/api/models/user.ts @@ -1,4 +1,7 @@ +import * as mongo from 'mongodb'; + import db from '../../db/mongodb'; +import { IPost } from './post'; const collection = db.get('users'); @@ -31,6 +34,39 @@ export function isValidBirthday(birthday: string): boolean { return typeof birthday == 'string' && /^([0-9]{4})\-([0-9]{2})-([0-9]{2})$/.test(birthday); } -export interface IUser { +export type IUser = { + _id: mongo.ObjectID; + created_at: Date; + email: string; + followers_count: number; + following_count: number; + links: string[]; name: string; -} + password: string; + posts_count: number; + drive_capacity: number; + username: string; + username_lower: string; + token: string; + avatar_id: mongo.ObjectID; + banner_id: mongo.ObjectID; + data: any; + twitter: { + access_token: string; + access_token_secret: string; + user_id: string; + screen_name: string; + }; + description: string; + profile: { + location: string; + birthday: string; // 'YYYY-MM-DD' + tags: string[]; + }; + last_used_at: Date; + latest_post: IPost; + pinned_post_id: mongo.ObjectID; + is_pro: boolean; + is_suspended: boolean; + keywords: string[]; +}; |