def upgrade(): users = op.create_table( 'users', sa.Column('id', sa.String(50), primary_key=True, index=True), sa.Column('email', sa.String(100), unique=True, index=True, nullable=False), sa.Column('full_name', sa.String(100)), sa.Column('hashed_password', sa.String(100), nullable=False), sa.Column('is_active', sa.Boolean, default=True), sa.Column('created_at', sa.DateTime(), server_default=sa.func.current_timestamp(), nullable=False), sa.Column('updated_at', sa.DateTime(), server_default=sa.func.current_timestamp(), nullable=False), ) uuid = generate_uuid() password = create_hashing('Abcd1234') op.bulk_insert(users, [{ 'id': uuid, 'email': '*****@*****.**', 'full_name': 'Administrator', 'hashed_password': password, 'is_active': 1 }]) pass
async def override_dependency(email: Optional[str] = fake_email, ): return { "id": generate_uuid(), "email": email, "full_name": fake_name, "is_active": 1 }
def create(db: Session, product_category: schema.ProductCategoryCreate): uuid = generate_uuid() db_product_category = model.ProductCategory( id=uuid, name=product_category.name, ) db.add(db_product_category) db.commit() db.refresh(db_product_category) return db_product_category
def create(db: Session, user: user_schema.UserCreate): uuid = generate_uuid() hashpass = create_hashing(user.password) db_user = user_model.User(id=uuid, full_name=user.full_name, email=user.email, hashed_password=hashpass) db.add(db_user) db.commit() db.refresh(db_user) return db_user
def create(db: Session, product_insurance_type: schema.ProductInsuranceTypeCreate): uuid = generate_uuid() db_product_insurance_type = model.ProductInsuranceType( id=uuid, name=product_insurance_type.name, ) db.add(db_product_insurance_type) db.commit() db.refresh(db_product_insurance_type) return db_product_insurance_type
def create(db: Session, screenshot: schema.ScreenshotCreate): uuid = generate_uuid() db_screenshot = model.Screenshot( id=uuid, url=screenshot.url, file_extension=screenshot.file_extension, directory=screenshot.directory, ) db.add(db_screenshot) db.commit() db.refresh(db_screenshot) return db_screenshot
def create(db: Session, product_detail: schema.ProductDetailCreate): uuid = generate_uuid() db_product_detail = model.ProductDetail( id=uuid, summary=product_detail.summary, description=product_detail.description, icon=product_detail.icon, coverage_period=product_detail.coverage_period, ) db.add(db_product_detail) db.commit() db.refresh(db_product_detail) return db_product_detail
def create(db: Session, product: schema.ProductCreate): uuid = generate_uuid() db_product = model.Product( id=uuid, slug=product.slug, name=product.name, is_active=product.is_active, category_id=product.category_id, insurance_type_id=product.insurance_type_id, detail_id=product.detail_id, premium_type=product.premium_type, featured=product.featured, bundling_with_rider=product.bundling_with_rider) db.add(db_product) db.commit() db.refresh(db_product) return db_product