Skip to content

Commit

Permalink
chore: update example apps (#250)
Browse files Browse the repository at this point in the history
  • Loading branch information
zacharygolba authored Aug 1, 2016
1 parent 5f55d63 commit 4777e1a
Show file tree
Hide file tree
Showing 39 changed files with 252 additions and 289 deletions.
25 changes: 8 additions & 17 deletions examples/social-network/.eslintrc.json
Original file line number Diff line number Diff line change
@@ -1,26 +1,17 @@
{
"parser": "babel-eslint",
"extends": "eslint:recommended",
"env": {
"node": true
},
"extends": "eslint:recommended",
"globals": {
"after": true,
"before": true,
"describe": true,
"it": true,
"Map": true,
"Promise": true,
"Proxy": true,
"Set": true,
"Symbol": true,
"WeakMap": true
},
"parser": "babel-eslint",
"parserOptions": {
"ecmaVersion": 6,
"sourceType": "module"
},
"rules": {
"no-unused-vars": 1
"Proxy": true,
"Promise": true,
"Reflect": true,
"WeakMap": true,
"WeakSet": true,
"Iterable": true
}
}
4 changes: 2 additions & 2 deletions examples/social-network/app/controllers/categorizations.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ import { Controller } from 'lux-framework';

class CategorizationsController extends Controller {
params = [
'postId',
'tagId'
'tag',
'post'
];
}

Expand Down
6 changes: 4 additions & 2 deletions examples/social-network/app/controllers/comments.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,10 @@ import { Controller } from 'lux-framework';

class CommentsController extends Controller {
params = [
'message',
'edited'
'post',
'user',
'edited',
'message'
];
}

Expand Down
5 changes: 4 additions & 1 deletion examples/social-network/app/controllers/friendships.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
import { Controller } from 'lux-framework';

class FriendshipsController extends Controller {

params = [
'followee',
'follower'
];
}

export default FriendshipsController;
1 change: 1 addition & 0 deletions examples/social-network/app/controllers/posts.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import { Controller } from 'lux-framework';

class PostsController extends Controller {
params = [
'user',
'body',
'title',
'isPublic'
Expand Down
5 changes: 4 additions & 1 deletion examples/social-network/app/controllers/reactions.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,10 @@ import { Controller } from 'lux-framework';

class ReactionsController extends Controller {
params = [
'type'
'type',
'user',
'post',
'comment'
];
}

Expand Down
4 changes: 2 additions & 2 deletions examples/social-network/app/models/friendship.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@ class Friendship extends Model {
static belongsTo = {
follower: {
model: 'user',
inverse: 'followers',
inverse: 'followers'
},

followee: {
model: 'user',
inverse: 'followees',
inverse: 'followees'
}
};
}
Expand Down
5 changes: 0 additions & 5 deletions examples/social-network/app/models/reaction.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,5 @@
import { Model } from 'lux-framework';

import Comment from './comment';
import Notification from './notification';
import Post from './post';
import User from './user';

import track from '../utils/track';

class Reaction extends Model {
Expand Down
4 changes: 2 additions & 2 deletions examples/social-network/app/serializers/categorizations.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ import { Serializer } from 'lux-framework';

class CategorizationsSerializer extends Serializer {
hasOne = [
'post',
'tag'
'tag',
'post'
];
}

Expand Down
4 changes: 2 additions & 2 deletions examples/social-network/app/serializers/comments.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ import { Serializer } from 'lux-framework';

class CommentsSerializer extends Serializer {
attributes = [
'message',
'edited'
'edited',
'message'
];

hasOne = [
Expand Down
4 changes: 2 additions & 2 deletions examples/social-network/app/serializers/notifications.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ import { Serializer } from 'lux-framework';

class NotificationsSerializer extends Serializer {
attributes = [
'message',
'unread'
'unread',
'message'
];

hasOne = [
Expand Down
2 changes: 1 addition & 1 deletion examples/social-network/app/serializers/reactions.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ class ReactionsSerializer extends Serializer {
];

hasOne = [
'user',
'post',
'user',
'comment'
];
}
Expand Down
2 changes: 1 addition & 1 deletion examples/social-network/app/serializers/users.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ class UsersSerializer extends Serializer {
];

hasMany = [
'comments',
'posts',
'comments',
'followees',
'followers',
'reactions'
Expand Down
13 changes: 12 additions & 1 deletion examples/social-network/config/environments/development.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,14 @@
export default {
log: true
logging: {
level: 'DEBUG',
format: 'text',
enabled: true,

filter: {
params: [
'email',
'password'
]
}
}
};
13 changes: 12 additions & 1 deletion examples/social-network/config/environments/production.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,14 @@
export default {
log: false
logging: {
level: 'INFO',
format: 'json',
enabled: true,

filter: {
params: [
'email',
'password'
]
}
}
};
13 changes: 12 additions & 1 deletion examples/social-network/config/environments/test.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,14 @@
export default {
log: false
logging: {
level: 'WARN',
format: 'text',
enabled: false,

filter: {
params: [
'email',
'password'
]
}
}
};
Original file line number Diff line number Diff line change
Expand Up @@ -2,32 +2,23 @@ export function up(schema) {
return schema.createTable('users', table => {
table.increments('id');

table
.string('name')
table.string('name')
.index()
.notNullable();

table
.string('email')
.notNullable()
.unique();
table.string('email')
.index()
.unique()
.notNullable();

table
.string('password')
table.string('password')
.notNullable();

table
.string('password_salt')
table.string('password_salt')
.notNullable();

table.timestamps();

table.index([
'id',
'name',
'email',
'created_at',
'updated_at'
]);
table.index(['created_at', 'updated_at']);
});
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
export function up(schema) {
return schema.createTable('actions', table => {
table.increments('id');
table.integer('trackable_id');
table.string('trackable_type');
table.timestamps();

table.index([
'id',
'trackable_id',
'trackable_type',
'created_at',
'updated_at'
]);
table.integer('trackable_id')
.index()
.notNullable();

table.string('trackable_type')
.index()
.notNullable();

table.timestamps();
table.index(['created_at', 'updated_at']);
});
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,32 +2,22 @@ export function up(schema) {
return schema.createTable('comments', table => {
table.increments('id');

table
.string('message')
table.string('message')
.notNullable();

table
.boolean('edited')
.defaultTo(false)
.notNullable();
table.boolean('edited')
.index()
.notNullable()
.defaultTo(false);

table
.integer('user_id')
.notNullable();
table.integer('user_id')
.index();

table
.integer('post_id')
.notNullable();
table.integer('post_id')
.index();

table.timestamps();

table.index([
'id',
'user_id',
'post_id',
'created_at',
'updated_at'
]);
table.index(['created_at', 'updated_at']);
});
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,32 +2,25 @@ export function up(schema) {
return schema.createTable('reactions', table => {
table.increments('id');

table
.enum('type', [
':+1:',
':heart:',
':confetti_ball:',
':laughing:',
':disappointed:'
])
.notNullable();
table.enum('type', [
':+1:',
':heart:',
':confetti_ball:',
':laughing:',
':disappointed:'
]).index().notNullable();

table
.integer('user_id')
.notNullable();
table.integer('user_id')
.index();

table.integer('post_id');
table.integer('comment_id');
table.timestamps();
table.integer('post_id')
.index();

table.integer('comment_id')
.index();

table.index([
'id',
'user_id',
'post_id',
'comment_id',
'created_at',
'updated_at'
]);
table.timestamps();
table.index(['created_at', 'updated_at']);
});
}

Expand Down
Loading

0 comments on commit 4777e1a

Please sign in to comment.