Add reference data models and seed data for incoterms, invoice types, material types, payment methods, pedimento codes, pedimento regimens, sectors, states, transport modes, transport types, and valuation methods
- Implemented SQLAlchemy models for incoterms, invoice types, material types, payment methods, pedimento codes, pedimento regimens, sectors, states, transport modes, transport types, and valuation methods. - Added seed data for each reference data model to populate the database with initial values. - Ensured primary key constraints and appropriate data types for each model. - Established relationships where necessary, particularly in pedimento codes and regimens.
This commit is contained in:
@@ -0,0 +1,17 @@
|
||||
from sqlalchemy import String, SmallInteger, PrimaryKeyConstraint
|
||||
from sqlalchemy.orm import mapped_column, Mapped
|
||||
from core.database import Base
|
||||
|
||||
class Sector(Base):
|
||||
__tablename__ = "sectors" #GSectores
|
||||
__table_args__ = (
|
||||
PrimaryKeyConstraint("key", name="sectors_pkey"),
|
||||
{"schema": "public"} # opcional
|
||||
)
|
||||
|
||||
key: Mapped[str] = mapped_column(String(8), nullable=False) # clave del sector
|
||||
description: Mapped[str] = mapped_column(String(150), nullable=False) # descripción oficial (en español)
|
||||
authorized: Mapped[SmallInteger] = mapped_column(SmallInteger) # 1 = autorizado, 0 = no autorizado
|
||||
|
||||
def __repr__(self):
|
||||
return f"<Sector(key={self.key}, description={self.description}, authorized={self.authorized})>"
|
||||
35
backend/api/v1/modules/public/reference_data/sectors/seed.py
Normal file
35
backend/api/v1/modules/public/reference_data/sectors/seed.py
Normal file
@@ -0,0 +1,35 @@
|
||||
seed = [
|
||||
("I", "INDUSTRIA ELECTRICA", "0"),
|
||||
("II", "INDUSTRIA ELECTRONICA", "0"),
|
||||
("IIa", "PARA LOS BIENES A QUE SE REFIERE LA FRACCION II, INCISO a) o b), DE ARTICULO 4to DE ESTE DECRETO.", "0"),
|
||||
("IIb", "PARA LOS BIENES A QUE SE REFIERE LA FRACCION II, INCISO b), DE ARTICULO 4to DE ESTE DECRETO.", "0"),
|
||||
("III", "INDUSTRIA DEL MUEBLE", "0"),
|
||||
("IV", "INDUSTRIA DEL JUGUETE, JUEGOS DE RECREO Y ARTICULOS DEPORTIVOS", "0"),
|
||||
("IX", "INDUSTRIA DE MAQUINARIA AGRICOLA", "0"),
|
||||
("V", "INDUSTRIA DEL CALZADO", "0"),
|
||||
("VI", "INDUSTRIA MINERA Y METALURGICA", "0"),
|
||||
("VII", "INDUSTRIA DE BIENES DE CAPITAL", "0"),
|
||||
("VIII", "INDUSTRIA FOTOGRAFICA", "0"),
|
||||
("X", "INDUSTRIAS DIVERSAS", "0"),
|
||||
("XI", "INDUSTRIA QUIMICA", "0"),
|
||||
("XII", "INDUSTRIAS DE MANUFACTURAS DEL CAUCHO Y PLASTICOS", "0"),
|
||||
("XIII", "INDUSTRIA SIDERURGICA", "0"),
|
||||
("XIV", "INDUSTRIA DE PRODUCTOS FARMOQUIMICOS, MEDICAMENTOS Y EQUIPO MEDICO", "0"),
|
||||
("XIX", "INDUSTRIA AUTOMOTRIZ Y DE AUTOPARTES", "0"),
|
||||
("XIXa", "INDUSTRIA AUTOMOTRIZ Y DE AUTOPARTES", "0"),
|
||||
("XIXb", "INDUSTRIA AUTOMOTRIZ Y DE AUTOPARTES", "0"),
|
||||
("XV", "INDUSTRIA DEL TRANSPORTE, EXCEPTO EL SECTOR DE LA INDUSTRIA AUTOMOTRIZ Y DE AUTOPARTES", "0"),
|
||||
("XVa", "INDUSTRIA DEL TRANSPORTE, EXCEPTO EL SECTOR DE LA INDUSTRIA AUTOMOTRIZ Y DE AUTOPARTES.", "0"),
|
||||
("XVb", "INDUSTRIA DEL TRANSPORTE, EXCEPTO EL SECTOR DE LA INDUSTRIA AUTOMOTRIZ Y DE AUTOPARTES.", "0"),
|
||||
("XVI", "INDUSTRIA DEL PAPEL Y CARTON", "0"),
|
||||
("XVII", "INDUSTRIA DE LA MADERA", "0"),
|
||||
("XVIII", "INDUSTRIA DEL CUERO Y PIELES", "0"),
|
||||
("XX", "INDUSTRIA TEXTIL Y DE LA CONFECCION", "0"),
|
||||
("XXa", "INDUSTRIA TEXTIL Y DE LA CONFECCION", "0"),
|
||||
("XXb", "INDUSTRIA TEXTIL Y DE LA CONFECCION", "0"),
|
||||
("XXc", "INDUSTRIA TEXTIL Y DE LA CONFECCION", "0"),
|
||||
("XXd", "INDUSTRIA TEXTIL Y DE LA CONFECCION", "0"),
|
||||
("XXe", "INDUSTRIA TEXTIL Y DE LA CONFECCION", "0"),
|
||||
("XXI", "INDUSTRIA DE CHOCOLATES, DULCES Y SIMILARES", "0"),
|
||||
("XXII", "INDUSTRIA DEL CAFE", "0"),
|
||||
]
|
||||
Reference in New Issue
Block a user