Skip to content

Commit

Permalink
[FIX] nick feedback (#589)
Browse files Browse the repository at this point in the history
* fix id and add username

* test for inclusion of id
  • Loading branch information
jdkent authored Sep 12, 2023
1 parent 9cd54a5 commit 6d33105
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 2 deletions.
7 changes: 7 additions & 0 deletions store/neurostore/models/data.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,13 @@ class Studyset(BaseMixin, db.Model):
backref=backref("studysets", lazy="dynamic"),
)
annotations = relationship("Annotation", cascade="all, delete", backref="studyset")
__ts_vector__ = db.Column(
TSVector(),
db.Computed(
"to_tsvector('english', coalesce(name, '') || ' ' || coalesce(description, ''))",
persisted=True,
),
)


class Annotation(BaseMixin, db.Model):
Expand Down
3 changes: 2 additions & 1 deletion store/neurostore/schemas/data.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,11 +51,12 @@ def _serialize(self, value, attr, obj, **ser_kwargs):
return nested_schema.dump(value, many=self.many)
elif self.context.get("info"):
info_fields = [
"id",
"_id",
"updated_at",
"created_at",
"source",
"user",
"username",
"studysets",
"has_coordinates",
"has_images",
Expand Down
2 changes: 1 addition & 1 deletion store/neurostore/tests/api/test_base_studies.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ def test_info_base_study(auth_client, ingest_neurosynth, session):
assert single_info_resp.status_code == 200
assert single_reg_resp.status_code == 200

assert "updated_at" in single_info_resp.json["versions"][0]
assert "id" in single_info_resp.json["versions"][0]
assert isinstance(single_reg_resp.json["versions"][0], str)


Expand Down

0 comments on commit 6d33105

Please sign in to comment.