Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add restangular for app usage #59

Merged
merged 3 commits into from
Jan 26, 2017
Merged

Add restangular for app usage #59

merged 3 commits into from
Jan 26, 2017

Conversation

MatiasComercio
Copy link
Owner

Summary

  • Add grunt-connect-proxy npm dependency
    • Update Gruntfile to use this dependency.
    • API must be served at localhost:7070 during development so as to be
      able to use livereload of angular changes and use a static version
      (war) of the API.
    • Solve Cross Origin request problem with browsers
  • Add Students service extending Restangular
  • Add Courses service extending Restangular
  • Add example of Students and Courses services usage on HomeCtrl
  • Add spec utils service
  • Add api responses service for testing purposes only (working as
    cassetes for api calls)
  • Add all test cases

Trello Card

https://trello.com/c/zaZ5yBjv/8-configurar-restangular

@codecov-io
Copy link

codecov-io commented Jan 25, 2017

Current coverage is 11.70% (diff: 97.22%)

Merging #59 into development will increase coverage by 2.32%

@@           development        #59   diff @@
=============================================
  Files               90         95     +5   
  Lines             2539       2606    +67   
  Methods              0          0          
  Messages             0          0          
  Branches           192        192          
=============================================
+ Hits               238        305    +67   
  Misses            2301       2301          
  Partials             0          0          

Powered by Codecov. Last update 18ef123...2de1df2

https: false,
changeOrigin: true,
rewrite: {
'^/api/v1': '/grupo1'
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should be updated for current API build. There was a PR that updated this.

// Some of the following code was taken or adapted from:
// - https://github.com/mgonto/restangular/issues/98 (sanitizeRestangular)
// - http://www.bradoncode.com/blog/2015/07/25/tip-unit-test-promise-angular/ (promises)

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please remove the above comments: they are not from this code

@MatiasComercio
Copy link
Owner Author

You also may be handling authentication as it was added by gibarsin in a PR before.
Please update this and then it'll be ready to merge.

.antMatchers("/**").authenticated()
.and()
.addFilterBefore(new StatelessLoginFilter("/login", tokenAuthenticationService, userDetailsService, authenticationManager()), UsernamePasswordAuthenticationFilter.class)
.addFilterBefore(new StatelessLoginFilter("/api/v1/login", tokenAuthenticationService, userDetailsService, authenticationManager()), UsernamePasswordAuthenticationFilter.class)
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@gibarsin please check these changes

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

WebAuthConfig path changes are ok!

Copy link
Collaborator

@gibarsin gibarsin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

WebAuthConfig path changes are ok!

// only once and before the token is set
// This requests the token each time a request is made
// and in this instance it should already be set
RestangularConfigurer.addFullRequestInterceptor(
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Try to delete this duplication

// only once and before the token is set
// This requests the token each time a request is made
// and in this instance it should already be set
RestangularConfigurer.addFullRequestInterceptor(
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same

$rootScope = _$rootScope_;
$httpBackend = _$httpBackend_;
$cookies = _$cookies_;
specUtilsService = specUtils;
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove this. It's not being used.

- Add grunt-connect-proxy npm dependency
  - Update Gruntfile to use this dependency.
  - API must be served at localhost:7070 during development so as to be
    able to use livereload of angular changes and use a static version
    (war) of the API.
  - Solve Cross Origin request problem with browsers
- Add Students service extending Restangular
- Add Courses service extending Restangular
- Add example of Students and Courses services usage on HomeCtrl
- Add spec utils service
- Add api responses service for testing purposes only (working as
  cassetes for api calls)
- Add all test cases
- Add Authentication service
- Add $cookies service to handle user session
- Update login endpoint (back) to match the API path
- Add token header to services using restangular
- Add new spec cases for added components

Notes
- This functionality should be improved, but was implemented as to be
  able to deploy and test the app.
- Login is served at the /login path and should be completed in order to
  use the rest of the app's requests.
This avoids the duplication marked in the PR

Rename BodyController -> BodyCtrl
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants