-
Notifications
You must be signed in to change notification settings - Fork 60
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add #includes() to query class refactor: move repeatable logic to built in middleware and simplify controller actions feat: add chainable query interface refactor: remove half-baked polymorphism
- Loading branch information
1 parent
425b8de
commit 93e3c0a
Showing
77 changed files
with
2,089 additions
and
1,647 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,3 @@ | ||
{ | ||
"presets": [ | ||
"es2015", | ||
"stage-1" | ||
], | ||
"plugins": [ | ||
"transform-runtime", | ||
"transform-decorators-legacy" | ||
] | ||
} | ||
"presets": ["lux"] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,7 @@ | ||
import { Controller } from 'lux-framework'; | ||
|
||
import authenticate from '../middleware/authenticate'; | ||
|
||
class ApplicationController extends Controller { | ||
beforeAction = [ | ||
authenticate | ||
]; | ||
|
||
} | ||
|
||
export default ApplicationController; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,10 @@ | ||
import { Controller } from 'lux-framework'; | ||
|
||
import setUser from '../middleware/set-user'; | ||
|
||
class CommentsController extends Controller { | ||
params = [ | ||
'message', | ||
'edited' | ||
]; | ||
|
||
beforeAction = [ | ||
setUser | ||
]; | ||
} | ||
|
||
export default CommentsController; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,11 @@ | ||
import { Controller } from 'lux-framework'; | ||
|
||
import setUser from '../middleware/set-user'; | ||
|
||
class PostsController extends Controller { | ||
params = [ | ||
'body', | ||
'title', | ||
'isPublic' | ||
]; | ||
|
||
beforeAction = [ | ||
setUser | ||
]; | ||
} | ||
|
||
export default PostsController; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,9 @@ | ||
import { Controller } from 'lux-framework'; | ||
|
||
import setUser from '../middleware/set-user'; | ||
|
||
class ReactionsController extends Controller { | ||
params = [ | ||
'type' | ||
]; | ||
|
||
beforeAction = [ | ||
setUser | ||
]; | ||
} | ||
|
||
export default ReactionsController; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,56 +1,11 @@ | ||
import { Controller, action } from 'lux-framework'; | ||
|
||
import User from '../models/user'; | ||
import { Controller } from 'lux-framework'; | ||
|
||
class UsersController extends Controller { | ||
params = [ | ||
'name', | ||
'email', | ||
'password' | ||
]; | ||
|
||
@action | ||
async login(req, res) { | ||
const { | ||
session, | ||
|
||
params: { | ||
data: { | ||
attributes: { | ||
email, | ||
password | ||
} | ||
} | ||
} | ||
} = req; | ||
|
||
const user = await User.authenticate(email, password); | ||
|
||
if (user) { | ||
session.set('currentUserId', user.id); | ||
} | ||
|
||
return { | ||
data: user | ||
}; | ||
} | ||
|
||
@action | ||
logout(req, res) { | ||
const { | ||
session, | ||
|
||
session: { | ||
isAuthenticated | ||
} | ||
} = req; | ||
|
||
if (isAuthenticated) { | ||
session.delete('currentUserId'); | ||
} | ||
|
||
return isAuthenticated; | ||
} | ||
} | ||
|
||
export default UsersController; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,7 @@ | ||
import { Serializer } from 'lux-framework'; | ||
|
||
class ActionsSerializer extends Serializer { | ||
attributes = [ | ||
'trackableId', | ||
'trackableType' | ||
]; | ||
|
||
} | ||
|
||
export default ActionsSerializer; |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,3 @@ | ||
export default { | ||
log: true, | ||
domain: 'http://localhost:4000', | ||
sessionKey: 'social-network::development::session', | ||
sessionSecret: 'a6d027382e6c6405674d951fe4e39d50c567020dee231938de063524d339c758' | ||
log: true | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,3 @@ | ||
export default { | ||
log: false, | ||
domain: 'http://localhost:4000', | ||
sessionKey: 'social-network::session', | ||
sessionSecret: 'd54dc706d6b7f4f88ddefab178ec8e4370d3ba12d977d8aaff36b782402c207c' | ||
}; | ||
log: false | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,3 @@ | ||
export default { | ||
log: true, | ||
domain: 'http://localhost:4000', | ||
sessionKey: 'social-network::test::session', | ||
sessionSecret: 'a893efc5d2677a5aa8dc5adb599f4eee2ea660b426b6c053123eaab28c01ebff' | ||
}; | ||
log: false | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.