-
Notifications
You must be signed in to change notification settings - Fork 13
feat: contracts documents screen #138
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
Changes from all commits
24d6378
1ee32ec
19c8e00
18f232c
c02e20d
40cbc12
5417870
1b94058
d42450c
39534e5
005bcee
2f29a11
0082605
d6f0e71
ba9d172
55d063b
1a469f7
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -184,4 +184,18 @@ impl Database { | |
|
|
||
| Ok(contracts) | ||
| } | ||
|
|
||
| pub fn remove_contract( | ||
| &self, | ||
| contract_id: &[u8], | ||
| app_context: &AppContext, | ||
| ) -> rusqlite::Result<()> { | ||
| let network = app_context.network_string(); | ||
| let conn = self.conn.lock().unwrap(); | ||
| conn.execute( | ||
| "DELETE FROM contract WHERE contract_id = ? AND network = ?", | ||
| rusqlite::params![contract_id, network], | ||
| )?; | ||
| Ok(()) | ||
| } | ||
|
Comment on lines
+187
to
+200
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🛠️ Refactor suggestion Check for potential foreign key constraints or references when removing contracts. The newly added remove_contract method will delete the contract unconditionally. If other records reference the contract, removing it can cause orphaned references unless you have implemented cascading or manual cleanup. Double-check constraints to maintain referential integrity. |
||
| } | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
insert_scheduled_votes method.
When inserting multiple votes, ensure no partial insert states remain if an error arises midway. A transaction-based approach or an up-front check might be needed (depending on the DB schema).