Add Transaction log for gem and hourglass changes (#13589)

* Log all gem transactions to database

* Also store hourglass transactions

* Fix tests

* Display transaction history in hall of heroes for admins

* add tests to new API call

* hide transaction settings tab for non admins

* fix(lint): remove console

* fix(lint): various automatic corrections

* fix(transactions): use enum expected pluralizations

* fix api unit tests

* fix lint

* fix failing test

* Fix minor inconsistencies

* Log all gem transactions to database

* Also store hourglass transactions

* Fix tests

* Display transaction history in hall of heroes for admins

* add tests to new API call

* hide transaction settings tab for non admins

* fix(lint): remove console

* fix(lint): various automatic corrections

* fix(transactions): use enum expected pluralizations

* fix api unit tests

* fix lint

* Fix minor inconsistencies

Co-authored-by: Sabe Jones <sabrecat@gmail.com>
This commit is contained in:
Phillip Thelen
2022-01-31 22:36:15 +01:00
committed by GitHub
parent 5beb29305d
commit 6e43d4dc79
63 changed files with 1530 additions and 1089 deletions
File diff suppressed because it is too large Load Diff
@@ -0,0 +1,38 @@
import {
generateUser,
translate as t,
} from '../../../helpers/api-integration/v4';
describe('GET /members/:memberId/purchase-history', () => {
let user;
before(async () => {
user = await generateUser({
contributor: { admin: true },
});
});
it('validates req.params.memberId', async () => {
await expect(user.get('/members/invalidUUID/purchase-history')).to.eventually.be.rejected.and.eql({
code: 400,
error: 'BadRequest',
message: t('invalidReqParams'),
});
});
it('returns error if user is not admin', async () => {
const member = await generateUser();
const nonAdmin = await generateUser();
await expect(nonAdmin.get(`/members/${member._id}/purchase-history`)).to.eventually.be.rejected.and.eql({
code: 401,
error: 'NotAuthorized',
message: t('noAdminAccess'),
});
});
it('returns purchase history based on given user', async () => {
const member = await generateUser();
const response = await user.get(`/members/${member._id}/purchase-history`);
expect(response.length).to.equal(0);
});
});