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

Rename fields in upload torrent response to match latest changes in the database #283

Closed
Tracked by #275
josecelano opened this issue Sep 12, 2023 · 5 comments · Fixed by #522
Closed
Tracked by #275

Rename fields in upload torrent response to match latest changes in the database #283

josecelano opened this issue Sep 12, 2023 · 5 comments · Fixed by #522
Assignees
Labels
Code Cleanup / Refactoring Tidying and Making Neat Easy Good for Newcomers
Milestone

Comments

@josecelano
Copy link
Member

josecelano commented Sep 12, 2023

Parent issue: #275

After successfully uploading a torrent you get a response like this:

{
    "data": {
        "torrent_id": 2561,
        "info_hash": "3800bd712159f14e76519b6e4d786d6a2484d1e7",           <- canonical
        "original_info_hash": "3800bd712159f14e76519b6e4d786d6a2484d1e7"   <- original
    }
}

We decided to change the infohashes table to:

CREATE TABLE "torrust_torrent_info_hashes" (
	"info_hash"	TEXT NOT NULL,
	"canonical_info_hash"	TEXT NOT NULL,
	"original_is_known"	BOOLEAN NOT NULL,
	PRIMARY KEY("info_hash"),
	FOREIGN KEY("canonical_info_hash") REFERENCES "torrust_torrents"("info_hash") ON DELETE CASCADE
);

Where info_hash is the original info-hash (from the uploaded torrent file) and canonical_info_hash is the one we use to refer to the uploaded torrent (without non-standard info dict fields).

I think we should also rename the fields in this response:

{
    "data": {
        "torrent_id": 2561,
        "info_hash": "3800bd712159f14e76519b6e4d786d6a2484d1e7"              <- original
        "canonical_info_hash": "3800bd712159f14e76519b6e4d786d6a2484d1e7",   <- canonical
    }
}

The problem is we use the name info_hash in the torrust_torrents::info_hash, and renaming that field would require changes in many queries.

What do you think @da2ce7?

@alexohneander
Copy link
Contributor

I would be happy to take this task. @josecelano

@josecelano
Copy link
Member Author

I would be happy to take this task. @josecelano

hi @alexohneander, cool!

@josecelano
Copy link
Member Author

Hi, @alexohneander I'm assigning this issue to myself because I have finished all the other issues related to this one and I also wan tot finish this to close the epic.

@josecelano
Copy link
Member Author

Changes made in the frontend: torrust/torrust-index-api-lib#43

@josecelano josecelano linked a pull request Mar 6, 2024 that will close this issue
@josecelano
Copy link
Member Author

Relates to: torrust/torrust-index-gui#279

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Code Cleanup / Refactoring Tidying and Making Neat Easy Good for Newcomers
Projects
Status: Done
Development

Successfully merging a pull request may close this issue.

4 participants