Shri Jayaram commited on
Commit
354e320
·
unverified ·
2 Parent(s): ea4ac21 0a2c94c

Merge pull request #43 from yuvabe-ai-labs/feat/journaling

Browse files
alembic/versions/3380d93055a7_delete_posts_comments_likes_table.py ADDED
@@ -0,0 +1,74 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """delete posts,comments,likes table
2
+
3
+ Revision ID: 3380d93055a7
4
+ Revises: 217db60578fa
5
+ Create Date: 2025-12-06 21:27:45.958044
6
+
7
+ """
8
+ from typing import Sequence, Union
9
+
10
+ from alembic import op
11
+ import sqlalchemy as sa
12
+ import sqlmodel.sql.sqltypes
13
+ from sqlalchemy.dialects import postgresql
14
+
15
+ # revision identifiers, used by Alembic.
16
+ revision: str = '3380d93055a7'
17
+ down_revision: Union[str, Sequence[str], None] = '217db60578fa'
18
+ branch_labels: Union[str, Sequence[str], None] = None
19
+ depends_on: Union[str, Sequence[str], None] = None
20
+
21
+
22
+ def upgrade() -> None:
23
+ """Upgrade schema."""
24
+ # ### commands auto generated by Alembic - please adjust! ###
25
+ op.drop_constraint("likes_post_id_fkey", "likes", type_="foreignkey")
26
+ op.drop_constraint("comments_post_id_fkey", "comments", type_="foreignkey")
27
+ op.drop_table("posts")
28
+ op.drop_table("likes")
29
+ op.drop_table("comments")
30
+ op.alter_column('app_version', 'apk_download_link',
31
+ existing_type=sa.VARCHAR(),
32
+ nullable=False)
33
+ # ### end Alembic commands ###
34
+
35
+
36
+ def downgrade() -> None:
37
+ """Downgrade schema."""
38
+ # ### commands auto generated by Alembic - please adjust! ###
39
+ op.alter_column('app_version', 'apk_download_link',
40
+ existing_type=sa.VARCHAR(),
41
+ nullable=True)
42
+ op.create_table('comments',
43
+ sa.Column('id', sa.UUID(), autoincrement=False, nullable=False),
44
+ sa.Column('post_id', sa.UUID(), autoincrement=False, nullable=False),
45
+ sa.Column('user_id', sa.UUID(), autoincrement=False, nullable=False),
46
+ sa.Column('comment', sa.VARCHAR(), autoincrement=False, nullable=False),
47
+ sa.Column('created_at', postgresql.TIMESTAMP(), autoincrement=False, nullable=False),
48
+ sa.ForeignKeyConstraint(['post_id'], ['posts.id'], name=op.f('comments_post_id_fkey'), ondelete='CASCADE'),
49
+ sa.ForeignKeyConstraint(['user_id'], ['users.id'], name=op.f('comments_user_id_fkey'), ondelete='CASCADE'),
50
+ sa.PrimaryKeyConstraint('id', name=op.f('comments_pkey'))
51
+ )
52
+ op.create_table('likes',
53
+ sa.Column('id', sa.UUID(), autoincrement=False, nullable=False),
54
+ sa.Column('post_id', sa.UUID(), autoincrement=False, nullable=False),
55
+ sa.Column('user_id', sa.UUID(), autoincrement=False, nullable=False),
56
+ sa.Column('liked_at', postgresql.TIMESTAMP(), autoincrement=False, nullable=False),
57
+ sa.ForeignKeyConstraint(['post_id'], ['posts.id'], name=op.f('likes_post_id_fkey'), ondelete='CASCADE'),
58
+ sa.ForeignKeyConstraint(['user_id'], ['users.id'], name=op.f('likes_user_id_fkey'), ondelete='CASCADE'),
59
+ sa.PrimaryKeyConstraint('id', name=op.f('likes_pkey')),
60
+ sa.UniqueConstraint('user_id', 'post_id', name=op.f('likes_user_id_post_id_key'), postgresql_include=[], postgresql_nulls_not_distinct=False)
61
+ )
62
+ op.create_table('posts',
63
+ sa.Column('id', sa.UUID(), autoincrement=False, nullable=False),
64
+ sa.Column('user_id', sa.UUID(), autoincrement=False, nullable=True),
65
+ sa.Column('type', postgresql.ENUM('BIRTHDAY', 'NOTICE', 'BANNER', 'JOB_REQUEST', name='posttype'), autoincrement=False, nullable=False),
66
+ sa.Column('category', postgresql.ENUM('TEAM', 'GLOBAL', name='postcategory'), autoincrement=False, nullable=False),
67
+ sa.Column('caption', sa.VARCHAR(), autoincrement=False, nullable=True),
68
+ sa.Column('image', sa.VARCHAR(), autoincrement=False, nullable=True),
69
+ sa.Column('created_at', postgresql.TIMESTAMP(), autoincrement=False, nullable=False),
70
+ sa.Column('edited_at', postgresql.TIMESTAMP(), autoincrement=False, nullable=False),
71
+ sa.ForeignKeyConstraint(['user_id'], ['users.id'], name=op.f('posts_user_id_fkey'), ondelete='SET NULL'),
72
+ sa.PrimaryKeyConstraint('id', name=op.f('posts_pkey'))
73
+ )
74
+ # ### end Alembic commands ###
src/core/__init__.py CHANGED
@@ -1,7 +1,6 @@
1
  from src.auth import models as auth_models
2
  from src.chatbot import models as chatbot_models
3
  from src.core import models as core_models
4
- from src.feed import models as feed_models
5
  from src.home import models as home_models
6
  from src.profile import models as profile_models
7
  from src.wellbeing import models as wellbeing_models
 
1
  from src.auth import models as auth_models
2
  from src.chatbot import models as chatbot_models
3
  from src.core import models as core_models
 
4
  from src.home import models as home_models
5
  from src.profile import models as profile_models
6
  from src.wellbeing import models as wellbeing_models
src/feed/__init__.py DELETED
File without changes
src/feed/config.py DELETED
@@ -1,6 +0,0 @@
1
- from pydantic import BaseSettings
2
-
3
- class HomeSettings(BaseSettings):
4
- FEATURE_ENABLED: bool = True
5
-
6
- home_settings = HomeSettings()
 
 
 
 
 
 
 
src/feed/constants.py DELETED
@@ -1,2 +0,0 @@
1
- WELCOME_MESSAGE = "Welcome to Yuvabe's Home Screen"
2
- EXIT_MESSAGE = "Thank You have a wonderful day"
 
 
 
src/feed/dependencies.py DELETED
File without changes
src/feed/exceptions.py DELETED
File without changes
src/feed/models.py DELETED
@@ -1,75 +0,0 @@
1
- import uuid
2
- from datetime import datetime
3
- from enum import Enum
4
- from typing import Optional
5
-
6
- from sqlalchemy import UniqueConstraint, ForeignKey, Column
7
- from sqlmodel import Field, SQLModel
8
- from sqlalchemy.dialects.postgresql import UUID
9
-
10
-
11
- class PostType(str, Enum):
12
- BIRTHDAY = "Birthday"
13
- NOTICE = "Notice"
14
- BANNER = "Banner"
15
- JOB_REQUEST = "Job Request"
16
-
17
-
18
- class PostCategory(str, Enum):
19
- TEAM = "Team"
20
- GLOBAL = "Global"
21
-
22
-
23
- class Posts(SQLModel, table=True):
24
- __tablename__ = "posts"
25
- id: uuid.UUID = Field(default_factory=uuid.uuid4, primary_key=True)
26
- user_id: uuid.UUID = Field(
27
- sa_column=Column(UUID(as_uuid=True),
28
- ForeignKey("users.id", ondelete="SET NULL"),
29
- nullable=True
30
- )
31
- )
32
- type: PostType = Field(default=PostType.NOTICE)
33
- category: PostCategory = Field(default=PostCategory.GLOBAL)
34
- caption: Optional[str] = None
35
- image: Optional[str] = None
36
- created_at: datetime = Field(default_factory=datetime.now, nullable=False)
37
- edited_at: datetime = Field(default_factory=datetime.now)
38
-
39
-
40
- class Comments(SQLModel, table=True):
41
- __tablename__ = "comments"
42
- id: uuid.UUID = Field(default_factory=uuid.uuid4, primary_key=True)
43
- post_id: uuid.UUID = Field(
44
- sa_column=Column(UUID(as_uuid=True),
45
- ForeignKey("posts.id", ondelete="CASCADE"),
46
- nullable=False
47
- )
48
- )
49
- user_id: uuid.UUID = Field(
50
- sa_column=Column(UUID(as_uuid=True),
51
- ForeignKey("users.id", ondelete="CASCADE"),
52
- nullable=False
53
- )
54
- )
55
- comment: str = Field(nullable=False)
56
- created_at: datetime = Field(default_factory=datetime.now, nullable=False)
57
-
58
-
59
- class Likes(SQLModel, table=True):
60
- __tablename__ = "likes"
61
- __table_args__ = (UniqueConstraint("user_id", "post_id"),)
62
- id: uuid.UUID = Field(default_factory=uuid.uuid4, primary_key=True)
63
- post_id: uuid.UUID = Field(
64
- sa_column=Column(UUID(as_uuid=True),
65
- ForeignKey("posts.id", ondelete="CASCADE"),
66
- nullable=False
67
- )
68
- )
69
- user_id: uuid.UUID = Field(
70
- sa_column=Column(UUID(as_uuid=True),
71
- ForeignKey("users.id", ondelete="CASCADE"),
72
- nullable=False
73
- )
74
- )
75
- liked_at: datetime = Field(default_factory=datetime.now, nullable=False)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
src/feed/router.py DELETED
File without changes
src/feed/schemas.py DELETED
File without changes
src/feed/service.py DELETED
@@ -1,2 +0,0 @@
1
- from typing import List
2
- from uuid import UUID
 
 
 
src/feed/utils.py DELETED
File without changes
src/profile/models.py CHANGED
@@ -63,6 +63,4 @@ class UserDevices(SQLModel, table=True):
63
  )
64
  device_token: str
65
  last_seen: datetime = Field(default_factory=datetime.now)
66
- device_model: str
67
- platform: str
68
  updated_at: datetime = Field(default_factory=datetime.now)
 
63
  )
64
  device_token: str
65
  last_seen: datetime = Field(default_factory=datetime.now)
 
 
66
  updated_at: datetime = Field(default_factory=datetime.now)