import { Column, Entity, OneToMany, PrimaryGeneratedColumn } from "typeorm"; import { PosSystem } from ".."; @Entity({ name: "authentication_credential", comment: "Tabla creada para almacenar los tipos de autenticación que van a tener los sistemas POS.", }) export class AuthenticationCredential { @PrimaryGeneratedColumn({ type: "int", comment: "Número de identificación (ID) único de cada registro.", }) id: number; @Column({ length: 30, type: "varchar", comment: "Tipo de autenticación que va a tener el sistema:\r\n1. auth_basic: username/email y password para autenticación básica y JWT.\r\n\r\n2. auth_token: client_id y client_secret junto con username y password para OAuth 2.0 Password Grant.\r\n\r\n3. auth_oauth: client_id, redirect_uri, response_type, scope, y state para OAuth 2.0 Authorization Code Grant.\r\n\r\n4. auth_api_key: api_key para autenticación basada en claves API.\r\n\r\nAcá toca tener en cuenta cada tipo para hacer la respectiva autenticación, para esto ver ejemplos y usos de cada uno.", }) type: string; @Column({ length: 30, type: "varchar", comment: "Nombre del tipo de autenticación.", }) name: string; @Column({ length: 200, type: "varchar", comment: "Variables que se necesitan separadas por ,\r\nejemplo: username,password....\r\n\r\nEsto se tiene en cuenta para crear los elementos en el frontend y poder guardarlos en la tabla (pos_system -> settings).", }) variables: string; @Column({ default: 1, type: "int", width: 1, comment: "Estado del tipo de autenticación:\r\n0: Inactivo.\r\n1: Activo.", }) status: number; @OneToMany( () => PosSystem, (posSystem) => posSystem.authentication_credentials ) authenticationCredentials: PosSystem[]; }