forked from CybertownRevival/ctr
-
Notifications
You must be signed in to change notification settings - Fork 0
Mall staff workflow: object checker, inspection and JSON export #13
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
Open
DJAscendance
wants to merge
19
commits into
master
Choose a base branch
from
feat/mall-staff-workflow
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
19 commits
Select commit
Hold shift + click to select a range
cd503bd
feat: mall staff workflow — object checker, inspection and export
DJAscendance 5952288
fix: harden Mall staff workflow after review
DJAscendance 03358ec
fix: offer Accept and Reject only for pending objects
DJAscendance b58975e
docs: record the export's pending-only scope
DJAscendance 3b8bb3a
fix: refund before rejecting, and defer blob url revocation
DJAscendance 3d5e3e7
fix: make Mall rejection atomic and clean touched lint
DJAscendance 401edce
fix: credit wallets atomically, and bound the export by row
DJAscendance 27c9ef1
fix: clear stale Mall checker inspection during navigation
DJAscendance e82ce8f
fix: close concurrent rejection review findings
DJAscendance 92e7e00
fix: close late Mall review findings
DJAscendance 09100d9
fix: stabilize pending export snapshot
DJAscendance 183acaa
fix: close final Mall snapshot races
DJAscendance d9e8a37
feat: integrate Mall staff tools into the Cybertown shell
DJAscendance 83ebac5
feat: rebuild the Mall checker review workspace
DJAscendance 6dcbdf5
fix: pretty-print the streamed Pending export
DJAscendance 4606ba5
feat: notify uploaders when their Mall item is accepted
DJAscendance f164fa1
fix: finish Mall checker owner QA
DJAscendance 1be18cc
style: give Accept and Reject their own colour in the checker
DJAscendance 45b157d
test: guard Mall repository integration fixtures
DJAscendance File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 |
|---|---|---|
| @@ -0,0 +1,52 @@ | ||
| /** | ||
| * A stand-in for the `Db` class, for specs that have to import a controller. | ||
| * | ||
| * Controllers import the services barrel, which instantiates every repository at | ||
| * module load. `RoleRepository`'s constructor issues a query straight away, so | ||
| * merely importing a controller opens a MySQL connection and an unhandled | ||
| * rejection when no database is running. Mocking the module keeps controller | ||
| * specs pure and runnable without a database. | ||
| * | ||
| * Usage, at the top of a spec file: | ||
| * | ||
| * jest.mock('../db/db.class', () => require('@spec/mocks/db-module.mock').mockDbModule()); | ||
| */ | ||
|
|
||
| /** | ||
| * A query builder that is both awaitable (resolving to an empty result set) and | ||
| * infinitely chainable, so any repository call shape works without each spec | ||
| * having to enumerate knex's API. | ||
| */ | ||
| // eslint-disable-next-line @typescript-eslint/no-explicit-any | ||
| function makeBuilder(): any { | ||
| // Untyped on purpose: `Proxy`'s target must be a real awaitable object here, | ||
| // and every property this mock's `get` trap can return is another | ||
| // infinitely-chainable builder -- there is no knex type this could satisfy. | ||
| // eslint-disable-next-line @typescript-eslint/no-explicit-any | ||
| const resolved: any = Promise.resolve([]); | ||
| return new Proxy(resolved, { | ||
| get(target, property) { | ||
| if (property === 'then' || property === 'catch' || property === 'finally') { | ||
| return target[property].bind(target); | ||
| } | ||
| return () => makeBuilder(); | ||
| }, | ||
| }); | ||
| } | ||
|
|
||
| export function mockDbModule(): { Db: unknown } { | ||
| // eslint-disable-next-line @typescript-eslint/no-var-requires | ||
| const { Service } = require('typedi'); | ||
|
|
||
| class MockDb { | ||
| constructor() { | ||
| return new Proxy({}, { get: () => makeBuilder() }); | ||
| } | ||
| } | ||
|
|
||
| // The repositories are typedi services whose constructors ask the container for | ||
| // `Db`, so the replacement has to be registered exactly as the real class is. | ||
| Service()(MockDb); | ||
|
|
||
| return { Db: MockDb }; | ||
| } |
This file contains hidden or 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 +1,2 @@ | ||
| export * from './db.mock'; | ||
| export * from './db-module.mock'; |
This file contains hidden or 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.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.