Closed Kyeg closed 3 years ago
In following example, id 2551 is a suggestion
, and id 2581 is a document
.
> MindMap::Database::DocumentOrm.all
+------+-----------+---------------------------------+---------------------------------+---------------------------------+---------------------------+---------------------------+
| id | origin_id | name | description | html_url | created_at | updated_at |
+------+-----------+---------------------------------+---------------------------------+---------------------------------+---------------------------+---------------------------+
| 2551 | | tensorflow | An Open Source Machine Learn... | https://github.com/tensorflo... | 2020-12-09 23:11:48 +0800 | 2020-12-09 23:11:48 +0800 |
| 2552 | | TensorFlow | Project containig related ma... | https://github.com/romeokien... | 2020-12-09 23:11:48 +0800 | 2020-12-09 23:11:48 +0800 |
...
| 2580 | | TensorFlow-Tutorials | Simple tutorials using Googl... | https://github.com/nlintz/Te... | 2020-12-09 23:11:48 +0800 | 2020-12-09 23:11:48 +0800 |
| 2581 | 165785822 | derrxb | My space online for my photo... | https://github.com/derrxb/de... | 2020-12-09 23:25:30 +0800 | 2020-12-09 23:25:30 +0800 |
+------+-----------+---------------------------------+---------------------------------+---------------------------------+---------------------------+---------------------------+
If we try to access the suggestion from the database, some error will be caused.
Maybe because the format of suggestion
is different from the document
.
(Maybe because DRY-STRUCT does not prefer a nil
origin_id? I seem occur this error before.)
> http localhost:9000/api/v1/favorites/documents/2551
HTTP/1.1 500 Internal Server Error
Content-Length: 66
Content-Type: application/json
{
"message": "Could not access database.",
"status": "internal_error"
}
> http localhost:9000/api/v1/favorites/documents/2581
HTTP/1.1 200 OK
Content-Length: 319
Content-Type: application/json
{
"description": "My space online for my photography and software development thoughts",
"html_url": "https://github.com/derrxb/derrxb",
"links": [
{
"href": "http://localhost:9090/api/v1/inboxes/derrxb",
"rel": "self"
}
],
"name": "derrxb",
"origin_id": 165785822,
"topics": [
{
"name": "blog"
},
{
"name": "photography"
},
{
"name": "portfolio"
}
]
}
Currently, the
Suggestion Entity
in theInboxes Domain
and theDocument Entity
in theFavorites Domain
reuse the same database table. However, it seems some differences between these two entities. As following example, theDocument Entity
(e.g. id 2292) hasorigin_id
, while theSuggestion Entity
(e.g. id 2262~2291) does not.Maybe we can delete the
Suggestion Entity
& reuseDocument Entity
afterwards? Any suggestion?