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

Refactor repository #149

Merged
merged 59 commits into from
Aug 2, 2020
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
59 commits
Select commit Hold shift + click to select a range
3c82f2f
fix: nits
h13i32maru Jul 31, 2020
238bfc2
refactor(StreamRepo):
h13i32maru Jul 31, 2020
138cd93
refactor(StreamRepo):
h13i32maru Jul 31, 2020
7dfa9c6
refactor(StreamRepo):
h13i32maru Aug 1, 2020
adcbd23
refactor(StreamRepo):
h13i32maru Aug 1, 2020
2bad1d3
refactor(StreamRepo):
h13i32maru Aug 1, 2020
50c1584
refactor(StreamRepo):
h13i32maru Aug 1, 2020
dc07165
refactor(StreamRepo):
h13i32maru Aug 1, 2020
1ca4bf6
refactor(StreamRepo):
h13i32maru Aug 1, 2020
c88fea0
refactor(StreamRepo):
h13i32maru Aug 1, 2020
f5081be
refactor(StreamRepo):
h13i32maru Aug 1, 2020
e57bb00
refactor(StreamRepo):
h13i32maru Aug 1, 2020
eb726e5
refactor(StreamRepo):
h13i32maru Aug 1, 2020
ae12f7d
refactor(StreamRepo):
h13i32maru Aug 1, 2020
ca4b6bb
refactor(StreamRepo):
h13i32maru Aug 1, 2020
c6c26fd
refactor(FilterHistoryRepo):
h13i32maru Aug 1, 2020
9c37bed
refactor(FilterHistoryRepo):
h13i32maru Aug 1, 2020
0df5a99
refactor(StreamRepo):
h13i32maru Aug 1, 2020
de9adf3
refactor(StreamIssueRepo):
h13i32maru Aug 1, 2020
498447d
refactor:
h13i32maru Aug 1, 2020
67f7e7c
refactor(StreamIssueRepo):
h13i32maru Aug 1, 2020
5d17553
refactor(StreamIssueRepo):
h13i32maru Aug 1, 2020
a9e1f5e
refactor(SubscriptionIssueRepo):
h13i32maru Aug 1, 2020
c9496ac
refactor(SystemStreamRepo):
h13i32maru Aug 1, 2020
1ff6872
refactor(SystemStreamRepo):
h13i32maru Aug 1, 2020
933087b
refactor(SystemStreamRepo):
h13i32maru Aug 1, 2020
c3eee22
fix(Stream): query index calc
h13i32maru Aug 1, 2020
2e76678
refactor(SystemStreamRepo):
h13i32maru Aug 1, 2020
8a9af6d
refactor(SystemStreamRepo):
h13i32maru Aug 1, 2020
5b4678d
refactor(SystemStreamRepo):
h13i32maru Aug 1, 2020
be72387
refactor(SystemStreamRepo):
h13i32maru Aug 1, 2020
54b1f49
refactor(StreamPolling):
h13i32maru Aug 1, 2020
8bb448b
refactor(SystemStreamRepo):
h13i32maru Aug 1, 2020
9d10f56
refactor(SystemStreamRepo):
h13i32maru Aug 1, 2020
e135662
refactor(IssueRepo):
h13i32maru Aug 1, 2020
efceb1f
refactor(IssueRepo):
h13i32maru Aug 1, 2020
4e4059d
refactor(IssueRepo):
h13i32maru Aug 1, 2020
2b7e4ce
refactor(IssueRepo):
h13i32maru Aug 1, 2020
30f82e5
refactor(IssueRepo):
h13i32maru Aug 1, 2020
8d245b9
refactor(IssueRepo):
h13i32maru Aug 1, 2020
f0d0d98
refactor(IssueRepo):
h13i32maru Aug 1, 2020
0730d1e
refactor(IssueRepo):
h13i32maru Aug 1, 2020
457a361
refactor(IssueRepo):
h13i32maru Aug 1, 2020
59168df
refactor(VersionRepo):
h13i32maru Aug 1, 2020
8e2c123
refactor(IssueRepo):
h13i32maru Aug 1, 2020
3d9d5d6
refactor(IssueRepo):
h13i32maru Aug 1, 2020
19e50f8
refactor(IssueRepo):
h13i32maru Aug 1, 2020
bff9d34
refactor(IssueRepo):
h13i32maru Aug 1, 2020
b44e56c
refactor: nits
h13i32maru Aug 2, 2020
cab2570
refactor(IssueRepo):
h13i32maru Aug 2, 2020
8bcf72c
refactor(IssueRepo):
h13i32maru Aug 2, 2020
5166b9f
refactor(IssueRepo):
h13i32maru Aug 2, 2020
c0852ca
refactor(IssueRepo):
h13i32maru Aug 2, 2020
d71e3e7
refactor(IssueRepo):
h13i32maru Aug 2, 2020
eedb2d0
refactor(IssueRepo):
h13i32maru Aug 2, 2020
e45dc8d
refactor(StreamIssueRepo):
h13i32maru Aug 2, 2020
992dac7
refactor(DBIPC): show slow query
h13i32maru Aug 2, 2020
13aa0f8
refactor(Repo):
h13i32maru Aug 2, 2020
f9e5f9a
refactor(IssueRepo):
h13i32maru Aug 2, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
refactor(StreamRepo):
  • Loading branch information
h13i32maru committed Aug 1, 2020
commit c88fea0a729cdccf828f4173621c3406f6918e6f
7 changes: 6 additions & 1 deletion src/Renderer/Fragment/Stream/StreamsFragment.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import {IssueEvent} from '../../Event/IssueEvent';
import {IssueRepo} from '../../Repository/IssueRepo';
import {GARepo} from '../../Repository/GARepo';
import {FilteredStreamRepo} from '../../Repository/FilteredStreamRepo';
import {StreamPolling} from '../../Infra/StreamPolling';

const remote = electron.remote;
const MenuItem = remote.MenuItem;
Expand Down Expand Up @@ -207,7 +208,11 @@ export class StreamsFragment extends React.Component<any, State> {
}

async _deleteStream(stream) {
StreamRepo.deleteStream(stream.id);
const {error} = await StreamRepo.deleteStream(stream.id);
if (error) return console.error(error);

await StreamPolling.deleteStream(stream.id);
StreamEvent.emitRestartAllStreams();
}

_handleClickWithStream(stream) {
Expand Down
20 changes: 13 additions & 7 deletions src/Renderer/Repository/StreamRepo.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import {DBIPC} from '../../IPC/DBIPC';
import moment from 'moment';
import {StreamPolling} from '../Infra/StreamPolling';
import {StreamEvent} from '../Event/StreamEvent';
import {StreamEntity} from '../Type/StreamEntity';
import {DateUtil} from '../Util/DateUtil';
Expand Down Expand Up @@ -199,13 +198,20 @@ class _StreamRepo {
// StreamEvent.emitRestartAllStreams();
}

async deleteStream(streamId) {
await DBIPC.exec('delete from streams where id = ?', [streamId]);
await DBIPC.exec('delete from streams_issues where stream_id = ?', [streamId]);
await DBIPC.exec('delete from filtered_streams where stream_id = ?', [streamId]);
async deleteStream(streamId: number): Promise<{error?: Error}> {
const {error: e1} = await DBIPC.exec('delete from streams where id = ?', [streamId]);
if (e1) return {error: e1};

await StreamPolling.deleteStream(streamId);
StreamEvent.emitRestartAllStreams();
const {error: e2} = await DBIPC.exec('delete from streams_issues where stream_id = ?', [streamId]);
if (e2) return {error: e2};

const {error: e3} = await DBIPC.exec('delete from filtered_streams where stream_id = ?', [streamId]);
if (e3) return {error: e3};

// await StreamPolling.deleteStream(streamId);
// StreamEvent.emitRestartAllStreams();

return {};
}

async deleteFilteredStream(filteredStreamId) {
Expand Down