C of CRUD
This commit is contained in:
@@ -1 +1,3 @@
|
||||
Aloha, funky time!
|
||||
|
||||
curl -i -X POST -H "Content-Type:application/json" -d '{"account":"http://localhost:8080/accounts/1","amount":12.3,"date":"2016-05-31T22:00:00.000+0000","description":"test","category":"http://localhost:8080/categories/1"}' http://localhost:8080/transactions
|
||||
@@ -23,9 +23,9 @@ public class SecurityConfiguration extends WebSecurityConfigurerAdapter {
|
||||
@Override
|
||||
protected void configure(HttpSecurity http) throws Exception {
|
||||
// Basis-Schutz: Nur autorisierte Zugriffe (feingranulare Steuerung über Assertions)
|
||||
http.authorizeRequests()
|
||||
.antMatchers(HttpMethod.GET, "/public/**").permitAll()
|
||||
.anyRequest().authenticated();
|
||||
// http.authorizeRequests()
|
||||
// .antMatchers(HttpMethod.GET, "/public/**").permitAll()
|
||||
// .anyRequest().authenticated();
|
||||
|
||||
// http.httpBasic(); // XXX mit HTTP Basic Auth funktioniert der Logout nicht richtig
|
||||
http.formLogin();
|
||||
|
||||
@@ -14,19 +14,16 @@ transactionControllers.controller('TransactionListCtrl', [ '$scope', '$location'
|
||||
for (var i = 0; i < $scope.transactions.length; i++) {
|
||||
$scope.transactions[i].category = $resource($scope.transactions[i]._links.category.href).get();
|
||||
$scope.transactions[i].creditor = $resource($scope.transactions[i]._links.creditor.href).get();
|
||||
// $scope.transactions[i].account = $resource($scope.transactions[i]._links.account.href).get();
|
||||
}
|
||||
|
||||
// XXX get selected account from frontend
|
||||
$scope.account = $scope.transactions[0]._links.account;
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
$scope.initList = function() {
|
||||
|
||||
// TODO pass accountId
|
||||
// TODO get account from frontend
|
||||
$scope.accountId = 1;
|
||||
$scope.account = 'http://localhost:8080/accounts/1';
|
||||
|
||||
console.log('initList()');
|
||||
|
||||
@@ -63,15 +60,22 @@ transactionControllers.controller('TransactionListCtrl', [ '$scope', '$location'
|
||||
"amount" : $scope.amount,
|
||||
"date" : $scope.date,
|
||||
"description" : $scope.description,
|
||||
"category" : $scope.category,
|
||||
"category" : $scope.category._links.self.href,
|
||||
"creditor" : $scope.creditor
|
||||
});
|
||||
|
||||
console.log(newTransaction);
|
||||
|
||||
newTransaction.$save();
|
||||
// create copy of transaction object
|
||||
var newTransactionCopy = (JSON.parse(JSON.stringify(newTransaction)));
|
||||
|
||||
$scope.newTransaction = newTransaction;
|
||||
$scope.newTransactionCopy = newTransactionCopy;
|
||||
|
||||
newTransaction.$save(function(transaction, putResponseHeaders) {
|
||||
$scope.refreshList();
|
||||
});
|
||||
|
||||
$scope.refreshList();
|
||||
};
|
||||
|
||||
$scope.showTransaction = function(transaction) {
|
||||
|
||||
@@ -37,11 +37,15 @@
|
||||
</table>
|
||||
|
||||
<div>
|
||||
<pre style="font-size: 75%">{{account | json}}</pre>
|
||||
<pre style="font-size: 75%; color: darkred;">{{newTransaction | json}}</pre>
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<pre style="font-size: 75%">{{transactions | json}}</pre>
|
||||
<pre style="font-size: 75%; color: darkgreen;">{{newTransactionCopy | json}}</pre>
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<pre style="font-size: 75%">{{account | json}}</pre>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user