diff --git a/endpoints/whatsapp.get.py b/endpoints/whatsapp.get.py index fa437a7..8250ae2 100644 --- a/endpoints/whatsapp.get.py +++ b/endpoints/whatsapp.get.py @@ -1,53 +1,24 @@ -from fastapi import APIRouter, HTTPException -from sqlalchemy import Column, String, Integer -from sqlalchemy.ext.declarative import declarative_base -from typing import List - -Base = declarative_base() - -class Country(Base): - __tablename__ = "countries" - - id = Column(Integer, primary_key=True, index=True) - name = Column(String, unique=True, index=True) - code = Column(String, unique=True) - phone_code = Column(String) +from fastapi import APIRouter +import random router = APIRouter() +messages = [ + "Hey there! I am using WhatsApp", + "Available", + "In a meeting", + "At work", + "Battery about to die", + "Can't talk WhatsApp only", + "Urgent calls only", + "Sleeping" +] + @router.get("/whatsapp") -async def get_countries() -> List[dict]: - """Get list of countries with phone codes""" - countries = [ - {"name": "United States", "code": "US", "phone_code": "+1"}, - {"name": "United Kingdom", "code": "GB", "phone_code": "+44"}, - {"name": "India", "code": "IN", "phone_code": "+91"} - ] - +async def whatsapp_status(): + """Get random WhatsApp status""" return { + "message": random.choice(messages), "method": "GET", - "_verb": "get", - "countries": countries, - "total": len(countries) - } - -# Migration file -""" -from alembic import op -import sqlalchemy as sa - -def upgrade(): - op.create_table( - 'countries', - sa.Column('id', sa.Integer(), nullable=False), - sa.Column('name', sa.String(), nullable=False), - sa.Column('code', sa.String(), nullable=False), - sa.Column('phone_code', sa.String(), nullable=False), - sa.PrimaryKeyConstraint('id'), - sa.UniqueConstraint('name'), - sa.UniqueConstraint('code') - ) - -def downgrade(): - op.drop_table('countries') -""" \ No newline at end of file + "_verb": "get" + } \ No newline at end of file