summaryrefslogtreecommitdiff
path: root/src/models
diff options
context:
space:
mode:
authorsyuilo <syuilotan@yahoo.co.jp>2018-04-02 04:48:38 +0900
committersyuilo <syuilotan@yahoo.co.jp>2018-04-02 04:48:38 +0900
commit86e1ff6a6ff327522ec3b7470d6cea8f903f4b8f (patch)
tree6912a7cef8ecde26d2e3c032687c16db587265a5 /src/models
parentMerge pull request #1360 from syuilo/greenkeeper/jsdom-11.7.0 (diff)
downloadmisskey-86e1ff6a6ff327522ec3b7470d6cea8f903f4b8f.tar.gz
misskey-86e1ff6a6ff327522ec3b7470d6cea8f903f4b8f.tar.bz2
misskey-86e1ff6a6ff327522ec3b7470d6cea8f903f4b8f.zip
Refactor
Diffstat (limited to 'src/models')
-rw-r--r--src/models/user.ts85
1 files changed, 44 insertions, 41 deletions
diff --git a/src/models/user.ts b/src/models/user.ts
index 789b28b2f3..bbe9b5a533 100644
--- a/src/models/user.ts
+++ b/src/models/user.ts
@@ -39,45 +39,6 @@ export function isValidBirthday(birthday: string): boolean {
return typeof birthday == 'string' && /^([0-9]{4})\-([0-9]{2})-([0-9]{2})$/.test(birthday);
}
-type ILocalAccount = {
- keypair: string;
- email: string;
- links: string[];
- password: string;
- token: string;
- twitter: {
- accessToken: string;
- accessTokenSecret: string;
- userId: string;
- screenName: string;
- };
- line: {
- userId: string;
- };
- profile: {
- location: string;
- birthday: string; // 'YYYY-MM-DD'
- tags: string[];
- };
- lastUsedAt: Date;
- isBot: boolean;
- isPro: boolean;
- twoFactorSecret: string;
- twoFactorEnabled: boolean;
- twoFactorTempSecret: string;
- clientSettings: any;
- settings: any;
-};
-
-type IRemoteAccount = {
- inbox: string;
- uri: string;
- publicKey: {
- id: string;
- publicKeyPem: string;
- };
-};
-
type IUserBase = {
_id: mongo.ObjectID;
createdAt: Date;
@@ -102,8 +63,50 @@ type IUserBase = {
export type IUser = ILocalUser | IRemoteUser;
-export interface ILocalUser extends IUserBase { host: null; account: ILocalAccount; }
-export interface IRemoteUser extends IUserBase { host: string; account: IRemoteAccount; }
+export interface ILocalUser extends IUserBase {
+ host: null;
+ account: {
+ keypair: string;
+ email: string;
+ links: string[];
+ password: string;
+ token: string;
+ twitter: {
+ accessToken: string;
+ accessTokenSecret: string;
+ userId: string;
+ screenName: string;
+ };
+ line: {
+ userId: string;
+ };
+ profile: {
+ location: string;
+ birthday: string; // 'YYYY-MM-DD'
+ tags: string[];
+ };
+ lastUsedAt: Date;
+ isBot: boolean;
+ isPro: boolean;
+ twoFactorSecret: string;
+ twoFactorEnabled: boolean;
+ twoFactorTempSecret: string;
+ clientSettings: any;
+ settings: any;
+ };
+}
+
+export interface IRemoteUser extends IUserBase {
+ host: string;
+ account: {
+ inbox: string;
+ uri: string;
+ publicKey: {
+ id: string;
+ publicKeyPem: string;
+ };
+ };
+}
export const isLocalUser = (user: any): user is ILocalUser =>
user.host === null;