cs-models 0.0.665__py3-none-any.whl → 0.0.667__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of cs-models might be problematic. Click here for more details.

File without changes
@@ -0,0 +1,31 @@
1
+ from sqlalchemy import (
2
+ Column,
3
+ Integer,
4
+ String,
5
+ DateTime,
6
+ Boolean,
7
+ ForeignKey,
8
+ )
9
+ from datetime import datetime
10
+
11
+ from ...database import Base
12
+
13
+
14
+ class UserWorkbookModel(Base):
15
+ __tablename__ = 'user_workbooks'
16
+
17
+ id = Column(Integer, primary_key=True)
18
+ user_id = Column(String(128), nullable=False)
19
+ is_active = Column(Boolean, nullable=True)
20
+ workbook_id = Column(
21
+ Integer,
22
+ ForeignKey('workbooks.id'),
23
+ nullable=False,
24
+ )
25
+ updated_at = Column(
26
+ DateTime,
27
+ nullable=False,
28
+ # https://stackoverflow.com/questions/58776476/why-doesnt-freezegun-work-with-sqlalchemy-default-values
29
+ default=lambda: datetime.utcnow(),
30
+ onupdate=lambda: datetime.utcnow(),
31
+ )
@@ -0,0 +1,15 @@
1
+ from marshmallow import (
2
+ Schema,
3
+ fields,
4
+ validate,
5
+ )
6
+
7
+
8
+ class UserWorkbookResourceSchema(Schema):
9
+ not_blank = validate.Length(min=1, error="Field cannot be blank")
10
+
11
+ id = fields.Integer(dump_only=True)
12
+ user_id = fields.String(required=True, validate=not_blank)
13
+ is_active = fields.Boolean(required=True)
14
+ workbook_id = fields.Integer(required=True)
15
+ updated_at = fields.DateTime(dump_only=True)
File without changes
@@ -0,0 +1,33 @@
1
+ from sqlalchemy import (
2
+ Column,
3
+ Integer,
4
+ String,
5
+ DateTime,
6
+ Boolean,
7
+ )
8
+ from datetime import datetime
9
+ from sqlalchemy.orm import relationship
10
+
11
+ from ...database import Base
12
+ from ..WorkbookBlock.models import WorkbookBlockModel
13
+
14
+
15
+ class WorkbookModel(Base):
16
+ __tablename__ = 'workbooks'
17
+
18
+ id = Column(Integer, primary_key=True)
19
+ user_id = Column(String(128), nullable=False)
20
+ workbook_name = Column(String(128), nullable=False)
21
+ is_deleted = Column(Boolean, nullable=True)
22
+ created_at = Column(DateTime, nullable=False)
23
+ updated_at = Column(
24
+ DateTime,
25
+ default=datetime.utcnow,
26
+ onupdate=datetime.utcnow,
27
+ )
28
+
29
+ blocks = relationship(
30
+ "WorkbookBlockModel",
31
+ order_by=WorkbookBlockModel.sequence_number,
32
+ back_populates="workbook",
33
+ )
@@ -0,0 +1,16 @@
1
+ from marshmallow import (
2
+ Schema,
3
+ fields,
4
+ validate,
5
+ )
6
+
7
+
8
+ class WorkbookResourceSchema(Schema):
9
+ not_blank = validate.Length(min=1, error="Field cannot be blank")
10
+
11
+ id = fields.Integer(dump_only=True)
12
+ user_id = fields.String(required=True, validate=not_blank)
13
+ workbook_name = fields.String(required=True)
14
+ is_deleted = fields.Boolean(allow_none=True)
15
+ created_at = fields.DateTime(required=True)
16
+ updated_at = fields.DateTime(dump_only=True)
File without changes
@@ -0,0 +1,43 @@
1
+ from datetime import datetime
2
+
3
+ from sqlalchemy import Column, DateTime, Boolean, ForeignKey, Integer, Text, String
4
+ from sqlalchemy.orm import relationship
5
+
6
+ from ...database import Base
7
+ from ..WorkbookBlockComment.models import WorkbookBlockCommentModel
8
+
9
+
10
+ class WorkbookBlockModel(Base):
11
+ __tablename__ = "workbook_blocks"
12
+
13
+ id = Column(Integer, primary_key=True)
14
+ workbook_id = Column(
15
+ Integer,
16
+ ForeignKey("workbooks.id"),
17
+ nullable=False,
18
+ )
19
+ sequence_number = Column(Integer, nullable=False)
20
+ block_type = Column(String(50), nullable=False)
21
+ block_data = Column(Text, nullable=True)
22
+ is_deleted = Column(Boolean, nullable=True)
23
+ created_at = Column(DateTime, nullable=False, default=lambda: datetime.utcnow())
24
+ updated_at = Column(
25
+ DateTime,
26
+ nullable=False,
27
+ # https://stackoverflow.com/questions/58776476/why-doesnt-freezegun-work-with-sqlalchemy-default-values
28
+ default=lambda: datetime.utcnow(),
29
+ onupdate=lambda: datetime.utcnow(),
30
+ )
31
+
32
+ # These are ORM fields. Don't need to be added in the corresponding migration.
33
+ # https://docs.sqlalchemy.org/en/14/orm/tutorial.html#building-a-relationship
34
+ workbook = relationship(
35
+ "WorkbookModel",
36
+ back_populates="blocks",
37
+ )
38
+
39
+ comments = relationship(
40
+ "WorkbookBlockCommentModel",
41
+ order_by=WorkbookBlockCommentModel.sequence_number,
42
+ back_populates="workbook_block",
43
+ )
@@ -0,0 +1,15 @@
1
+ """Marshmallow Schema for AssistantCommand."""
2
+ from marshmallow import Schema, fields
3
+
4
+
5
+ class WorkbookBlockResourceSchema(Schema):
6
+ """Class for AssistantCommandResource schema"""
7
+
8
+ id = fields.Integer(dump_only=True)
9
+ workbook_id = fields.Integer(required=True)
10
+ sequence_number = fields.Integer(required=True)
11
+ block_type = fields.String(required=True)
12
+ block_data = fields.String(allow_none=True)
13
+ is_deleted = fields.Boolean(allow_none=True)
14
+ created_at = fields.DateTime(dump_only=True)
15
+ updated_at = fields.DateTime(dump_only=True)
File without changes
@@ -0,0 +1,36 @@
1
+ from datetime import datetime
2
+
3
+ from sqlalchemy import Column, DateTime, Boolean, ForeignKey, Integer, Text, String
4
+ from sqlalchemy.orm import relationship
5
+
6
+ from ...database import Base
7
+
8
+
9
+ class WorkbookBlockCommentModel(Base):
10
+ __tablename__ = "workbook_block_comments"
11
+
12
+ id = Column(Integer, primary_key=True)
13
+ block_id = Column(
14
+ Integer,
15
+ ForeignKey("workbook_blocks.id"),
16
+ nullable=False,
17
+ )
18
+ user_id = Column(String(128), nullable=False)
19
+ sequence_number = Column(Integer, nullable=False)
20
+ comment = Column(Text, nullable=True)
21
+ is_deleted = Column(Boolean, nullable=True)
22
+ created_at = Column(DateTime, nullable=False, default=lambda: datetime.utcnow())
23
+ updated_at = Column(
24
+ DateTime,
25
+ nullable=False,
26
+ # https://stackoverflow.com/questions/58776476/why-doesnt-freezegun-work-with-sqlalchemy-default-values
27
+ default=lambda: datetime.utcnow(),
28
+ onupdate=lambda: datetime.utcnow(),
29
+ )
30
+
31
+ # These are ORM fields. Don't need to be added in the corresponding migration.
32
+ # https://docs.sqlalchemy.org/en/14/orm/tutorial.html#building-a-relationship
33
+ workbook_block = relationship(
34
+ "WorkbookBlockModel",
35
+ back_populates="comments",
36
+ )
@@ -0,0 +1,15 @@
1
+ """Marshmallow Schema for AssistantCommand."""
2
+ from marshmallow import Schema, fields
3
+
4
+
5
+ class WorkbookBlockCommentResourceSchema(Schema):
6
+ """Class for AssistantCommandResource schema"""
7
+
8
+ id = fields.Integer(dump_only=True)
9
+ block_id = fields.Integer(required=True)
10
+ user_id = fields.String(required=True)
11
+ sequence_number = fields.Integer(required=True)
12
+ comment = fields.String(allow_none=True)
13
+ is_deleted = fields.Boolean(allow_none=True)
14
+ created_at = fields.DateTime(dump_only=True)
15
+ updated_at = fields.DateTime(dump_only=True)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: cs-models
3
- Version: 0.0.665
3
+ Version: 0.0.667
4
4
  Summary: MySQL db models
5
5
  Home-page: https://github.com/mindgram/cs-models
6
6
  Author: Shrey Verma
@@ -969,6 +969,9 @@ cs_models/resources/UserWatchlist/schemas.py,sha256=gM4N7ClcMGvyaSzIg95SSOw1EbFd
969
969
  cs_models/resources/UserWatchlistAccess/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
970
970
  cs_models/resources/UserWatchlistAccess/models.py,sha256=upjIxTL2WbKJF1fNVVLS1J_tw2TyDvHf0DCk5TVZQ8Q,794
971
971
  cs_models/resources/UserWatchlistAccess/schemas.py,sha256=YLC99AAtHJBltD_1vuzIPYX5uKERu6N9ljndhPJAWx8,438
972
+ cs_models/resources/UserWorkbook/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
973
+ cs_models/resources/UserWorkbook/models.py,sha256=1f5V5o4AcHElMY31bME4S1wm06bm3SbLucYJrzk0ONk,759
974
+ cs_models/resources/UserWorkbook/schemas.py,sha256=0roXytt6Rv8RS6Um9WPZbWz2eYptmxacc7SEp0c2vHQ,427
972
975
  cs_models/resources/ViewConditionByTA/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
973
976
  cs_models/resources/ViewConditionByTA/models.py,sha256=CieIW5mvmvok4dbglxd-ijMVI7gx-6C057CViSjuWoQ,764
974
977
  cs_models/resources/ViewConditionByTA/schemas.py,sha256=Y0hoMeysHulflnPUchmDP0NDsSTKtIZH-UXRvp2fIRw,441
@@ -1047,6 +1050,15 @@ cs_models/resources/ViewPublicationTarget/schemas.py,sha256=L_WUwBOz0i4yTGdibRI_
1047
1050
  cs_models/resources/Watchlist/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
1048
1051
  cs_models/resources/Watchlist/models.py,sha256=YpuJCjfZvgtK_uHJieJGAyIeC-B1Zxb-whCEKvHfsf8,1173
1049
1052
  cs_models/resources/Watchlist/schemas.py,sha256=2VLCMjiOA73pp_mtjo9kmWpgpOuXOCmlSQNwe39s8qw,1818
1053
+ cs_models/resources/Workbook/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
1054
+ cs_models/resources/Workbook/models.py,sha256=6sj9VhKTCnBL32_pkwUqfE9ESBRu1oCL2cpQn7bxlv8,822
1055
+ cs_models/resources/Workbook/schemas.py,sha256=4gqGGN5KthKoqAYmL6QnRKMX-gGH-x61-XInNZQyTzM,475
1056
+ cs_models/resources/WorkbookBlock/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
1057
+ cs_models/resources/WorkbookBlock/models.py,sha256=tYxYRt6210QdvgUldtmy3p3-srlVuEBZU2yCT01Xnag,1467
1058
+ cs_models/resources/WorkbookBlock/schemas.py,sha256=ETbgr7qkpVlX-A0r6aTnDoRLyfoveYMvoQ1KrO3aRAc,565
1059
+ cs_models/resources/WorkbookBlockComment/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
1060
+ cs_models/resources/WorkbookBlockComment/models.py,sha256=t1dLdweoPOzld1uBqrGJ3rrr66UkMwdiplNZEA1WtPU,1251
1061
+ cs_models/resources/WorkbookBlockComment/schemas.py,sha256=9UI_mTuPBYBk5qKUC2u0oR_clHA9XZ-bh5hhr24E-vs,563
1050
1062
  cs_models/resources_aact/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
1051
1063
  cs_models/resources_aact/something.py,sha256=WM5m0FzNJce1BgWjDc5YVnMQoHomeeKEyi36EKcd33s,1561
1052
1064
  cs_models/resources_aact/BriefSummary/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
@@ -1093,7 +1105,7 @@ cs_models/utils/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
1093
1105
  cs_models/utils/alchemy.py,sha256=fhINGFn41owJ2DLXQKXAAtLqeZ1BRzD_qU0wPK_bsGQ,1598
1094
1106
  cs_models/utils/utils.py,sha256=bY623DuzycfPQiaOQT2AxfANeWfwr5w76dBuQ813-ns,3664
1095
1107
  cs_models/utils/profiling/__init__.py,sha256=N-73vb0M92C975fxgXyBCBjCPELl8Oh21ZY_-tzDnns,569
1096
- cs_models-0.0.665.dist-info/METADATA,sha256=W0pIqSFDWMdtJiKZExlYyIlN_N9ysdDbjG_D1fa6nm4,792
1097
- cs_models-0.0.665.dist-info/WHEEL,sha256=G16H4A3IeoQmnOrYV4ueZGKSjhipXx8zc8nu9FGlvMA,92
1098
- cs_models-0.0.665.dist-info/top_level.txt,sha256=M7CA8Nh5t0vRManQ9gHfphhO16uhMqIbfaxr1jPDg18,10
1099
- cs_models-0.0.665.dist-info/RECORD,,
1108
+ cs_models-0.0.667.dist-info/METADATA,sha256=O4BFF74Z3IJGYVtVAh0uqsndPymWSiNuN32o4pUCKd8,792
1109
+ cs_models-0.0.667.dist-info/WHEEL,sha256=G16H4A3IeoQmnOrYV4ueZGKSjhipXx8zc8nu9FGlvMA,92
1110
+ cs_models-0.0.667.dist-info/top_level.txt,sha256=M7CA8Nh5t0vRManQ9gHfphhO16uhMqIbfaxr1jPDg18,10
1111
+ cs_models-0.0.667.dist-info/RECORD,,