ff-stream-web

git clone git://archive.git.mtrnord.blog/MTRNord/ff-stream-web.git
Log | Files | Refs | README | LICENSE

index.js (939B)


      1 /**
      2  * React Starter Kit (https://www.reactstarterkit.com/)
      3  *
      4  * Copyright © 2014-present Kriasoft, LLC. All rights reserved.
      5  *
      6  * This source code is licensed under the MIT license found in the
      7  * LICENSE.txt file in the root directory of this source tree.
      8  */
      9 
     10 import sequelize from '../sequelize';
     11 import User from './User';
     12 import UserLogin from './UserLogin';
     13 import UserClaim from './UserClaim';
     14 import UserProfile from './UserProfile';
     15 
     16 User.hasMany(UserLogin, {
     17   foreignKey: 'userId',
     18   as: 'logins',
     19   onUpdate: 'cascade',
     20   onDelete: 'cascade',
     21 });
     22 
     23 User.hasMany(UserClaim, {
     24   foreignKey: 'userId',
     25   as: 'claims',
     26   onUpdate: 'cascade',
     27   onDelete: 'cascade',
     28 });
     29 
     30 User.hasOne(UserProfile, {
     31   foreignKey: 'userId',
     32   as: 'profile',
     33   onUpdate: 'cascade',
     34   onDelete: 'cascade',
     35 });
     36 
     37 function sync(...args) {
     38   return sequelize.sync(...args);
     39 }
     40 
     41 export default { sync };
     42 export { User, UserLogin, UserClaim, UserProfile };