Skip to content

Instantly share code, notes, and snippets.

@juanmav
Created December 4, 2017 15:24
Show Gist options
  • Select an option

  • Save juanmav/367159d5aff2e9d8fe174f91ba3b63d0 to your computer and use it in GitHub Desktop.

Select an option

Save juanmav/367159d5aff2e9d8fe174f91ba3b63d0 to your computer and use it in GitHub Desktop.
example.md

TSJ CORE 111

En este documento se describen los servicios expuestos por el modulo core de la plataforma.

Group Login y autenticacion.

El login nos dara un JWT (Json web token) para se utilizado en las subsiguientes llamadas.

Creacion de credencial [/auth/token/]

Uso

Una vez obtenido el token, que nos dice que perfil y a que establecimiento esta asignada la persona hay que usar en todas las subsiguientes llamadas el header x-access-token con el string token de la respuesta de creacion de la credencial.

Crear [POST]

  • Request (application/json)

      { 
          "username": "tjsdelegado1", 
          "password": "123"
      }
    
  • Response 200 (application/json)

      {
        "username": "tjsdelegado1",
        "profileAssignment": {
          "id": -3,
          "profile": {
            "id": 3,
            "name": "Delegado",
            "description": "Delegado de una Jornada",
            "createdAt": "2017-01-23T19:06:25.038Z",
            "updatedAt": "2017-01-23T19:06:25.038Z"
          }
        },
        "establishment": {
          "id": -1,
          "name": "Escuela Numero 10",
          "code": "E102Q",
          "description": "Escuela muy amplia",
          "comuna": null,
          "circuit": "345",
          "comisaria": null,
          "responsable": "José Leon Soarez",
          "responsableData": "+541123487791",
          "minimumDelegates": 2,
          "minimumCoordinator": 2,
          "createdAt": "2017-01-23T19:06:25.330Z",
          "updatedAt": "2017-01-23T19:06:25.330Z",
          "establishmenttypeId": 1,
          "addressId": "-10",
          "delegateestablishment": {
            "createdAt": "2017-01-23T19:06:25.345Z",
            "updatedAt": "2017-01-23T19:06:25.345Z",
            "EstablishmentId": -1,
            "ProfileAssignmentId": -3
          }
        },
        "token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VybmFtZSI6InRqc2RlbGVnYWRvMSIsInByb2ZpbGVBc3NpZ25tZW50Ijp7ImlkIjotMywicHJvZmlsZSI6eyJpZCI6MywibmFtZSI6IkRlbGVnYWRvIiwiZGVzY3JpcHRpb24iOiJEZWxlZ2FkbyBkZSB1bmEgSm9ybmFkYSIsImNyZWF0ZWRBdCI6IjIwMTctMDEtMjNUMTk6MDY6MjUuMDM4WiIsInVwZGF0ZWRBdCI6IjIwMTctMDEtMjNUMTk6MDY6MjUuMDM4WiJ9fSwiZXN0YWJsaXNobWVudCI6eyJpZCI6LTEsIm5hbWUiOiJFc2N1ZWxhIE51bWVybyAxMCIsImNvZGUiOiJFMTAyUSIsImRlc2NyaXB0aW9uIjoiRXNjdWVsYSBtdXkgYW1wbGlhIiwiY29tdW5hIjpudWxsLCJjaXJjdWl0IjoiMzQ1IiwiY29taXNhcmlhIjpudWxsLCJyZXNwb25zYWJsZSI6Ikpvc8OpIExlb24gU29hcmV6IiwicmVzcG9uc2FibGVEYXRhIjoiKzU0MTEyMzQ4Nzc5MSIsIm1pbmltdW1EZWxlZ2F0ZXMiOjIsIm1pbmltdW1Db29yZGluYXRvciI6MiwiY3JlYXRlZEF0IjoiMjAxNy0wMS0yM1QxOTowNjoyNS4zMzBaIiwidXBkYXRlZEF0IjoiMjAxNy0wMS0yM1QxOTowNjoyNS4zMzBaIiwiZXN0YWJsaXNobWVudHR5cGVJZCI6MSwiYWRkcmVzc0lkIjoiLTEwIiwiZGVsZWdhdGVlc3RhYmxpc2htZW50Ijp7ImNyZWF0ZWRBdCI6IjIwMTctMDEtMjNUMTk6MDY6MjUuMzQ1WiIsInVwZGF0ZWRBdCI6IjIwMTctMDEtMjNUMTk6MDY6MjUuMzQ1WiIsIkVzdGFibGlzaG1lbnRJZCI6LTEsIlByb2ZpbGVBc3NpZ25tZW50SWQiOi0zfX0sImlhdCI6MTQ4NTE5ODQwNn0.R487LDGpulqYUlT5typgvAuqJtHxt0As8wxtpF4Ut1s"
      }
    

Group Elecciones

Las elecciones son agrupadores de jornadas.

Actual [/election/current]

Devuelve la eleccion activa con sus atributos.

Obtener [GET]

  • Response 200 (application/json)

      {
        "id": -1,
        "year": "2017",
        "description": "Elecciones lesgilativas 2017",
        "observations": "Primer eleccion monitoreada con NodeJs!",
        "active": true,
        "createdAt": "2016-12-15T16:06:48.511Z",
        "updatedAt": "2016-12-15T16:06:48.511Z",
        "ElectionDays": [
          {
            "id": -1,
            "date": "2016-12-15T16:06:48.526Z",
            "description": "Jornada Paso",
            "observations": "una jornada de tipo paso.",
            "active": true,
            "createdAt": "2016-12-15T16:06:48.526Z",
            "updatedAt": "2016-12-15T16:06:48.526Z",
            "ElectionId": -1,
            "ElectionDayTypeId": 1,
            "Establishments": [
              {
                "id": 1,
                "name": "Escuela Numero 10",
                "code": "E102Q",
                "description": "Escuela muy amplia",
                "comuna": null,
                "circuit": "345",
                "comisaria": null,
                "responsable": "José Leon Soarez",
                "responsableData": "+541123487791",
                "createdAt": "2016-12-14T20:22:28.176Z",
                "updatedAt": "2016-12-15T18:03:30.052Z",
                "ElectionDayId": -1,
                "establishmenttypeId": 1,
                "delegatebossId": null,
                "addressId": "1",
                "coordinator": [],
                "delegateboss": null,
                "delegates": [],
                "establishmenttype": {
                  "id": 1,
                  "name": "Escuela",
                  "description": "Escuela",
                  "createdAt": "2016-12-15T16:06:48.326Z",
                  "updatedAt": "2016-12-15T16:06:48.326Z"
                },
                "address": {
                  "coordinates": {
                    "type": "Feature",
                    "properties": {},
                    "geometry": {
                      "type": "Point",
                      "coordinates": [
                        -27.421,
                        -14.944
                      ]
                    }
                  },
                  "id": 1,
                  "value": "Av Medrano 750",
                  "location": "CABA",
                  "comune": 1,
                  "policestation": 1,
                  "createdAt": "2016-12-14T20:22:28.100Z",
                  "updatedAt": "2016-12-15T18:03:30.058Z"
                }
              },
              {
                "id": -1,
                "name": "Escuela Numero 10",
                "code": "E102Q",
                "description": "Escuela muy amplia",
                "comuna": null,
                "circuit": "345",
                "comisaria": null,
                "responsable": "José Leon Soarez",
                "responsableData": "+541123487791",
                "createdAt": "2016-12-15T16:06:48.621Z",
                "updatedAt": "2016-12-15T16:06:48.621Z",
                "ElectionDayId": -1,
                "establishmenttypeId": 1,
                "delegatebossId": -2,
                "addressId": "-1",
                "coordinator": [
                  {
                    "id": -1,
                    "createdAt": "2016-12-15T16:06:48.599Z",
                    "updatedAt": "2016-12-15T16:06:48.599Z",
                    "userId": -1,
                    "profileId": 1,
                    "electiondayId": -1,
                    "UserId": -1,
                    "coordinatorestablishment": {
                      "createdAt": "2016-12-15T16:06:48.652Z",
                      "updatedAt": "2016-12-15T16:06:48.652Z",
                      "EstablishmentId": -1,
                      "ProfileAssignmentId": -1
                    },
                    "user": {
                      "id": -1,
                      "name": "User Coordinador",
                      "lastname": "User Coordinador",
                      "dni": 11111111,
                      "birthdate": null,
                      "username": "tjscoordinator",
                      "last_access": null,
                      "cbu": null,
                      "enable": null,
                      "legajo": null,
                      "dependecy": null,
                      "profession": null,
                      "position": null,
                      "experience": null,
                      "enroled": null,
                      "admin": false,
                      "createdAt": "2016-12-15T16:06:48.555Z",
                      "updatedAt": "2016-12-15T16:06:48.555Z",
                      "addressId": -1,
                      "delegationId": -1
                    }
                  }
                ],
                "delegateboss": {
                  "id": -2,
                  "createdAt": "2016-12-15T16:06:48.599Z",
                  "updatedAt": "2016-12-15T16:06:48.599Z",
                  "userId": -2,
                  "profileId": 2,
                  "electiondayId": -1,
                  "UserId": -2,
                  "user": {
                    "id": -2,
                    "name": "User Delegado Encargado",
                    "lastname": "User Delegado Encargado",
                    "dni": 22222222,
                    "birthdate": null,
                    "username": "tjsdelegatoencargado",
                    "last_access": null,
                    "cbu": null,
                    "enable": null,
                    "legajo": null,
                    "dependecy": null,
                    "profession": null,
                    "position": null,
                    "experience": null,
                    "enroled": null,
                    "admin": false,
                    "createdAt": "2016-12-15T16:06:48.555Z",
                    "updatedAt": "2016-12-15T16:06:48.555Z",
                    "addressId": -1,
                    "delegationId": -1
                  }
                },
                "delegates": [
                  {
                    "id": -3,
                    "createdAt": "2016-12-15T16:06:48.599Z",
                    "updatedAt": "2016-12-15T16:06:48.599Z",
                    "userId": -3,
                    "profileId": 3,
                    "electiondayId": -1,
                    "UserId": -3,
                    "delegateestablishment": {
                      "createdAt": "2016-12-15T16:06:48.636Z",
                      "updatedAt": "2016-12-15T16:06:48.636Z",
                      "EstablishmentId": -1,
                      "ProfileAssignmentId": -3
                    },
                    "user": {
                      "id": -3,
                      "name": "User Delegado 1",
                      "lastname": "User Delegado 1",
                      "dni": 33333333,
                      "birthdate": null,
                      "username": "tjsdelegado1",
                      "last_access": null,
                      "cbu": null,
                      "enable": null,
                      "legajo": null,
                      "dependecy": null,
                      "profession": null,
                      "position": null,
                      "experience": null,
                      "enroled": null,
                      "admin": false,
                      "createdAt": "2016-12-15T16:06:48.555Z",
                      "updatedAt": "2016-12-15T16:06:48.555Z",
                      "addressId": -1,
                      "delegationId": -1
                    }
                  }
                ],
                "establishmenttype": {
                  "id": 1,
                  "name": "Escuela",
                  "description": "Escuela",
                  "createdAt": "2016-12-15T16:06:48.326Z",
                  "updatedAt": "2016-12-15T16:06:48.326Z"
                },
                "address": {
                  "coordinates": {
                    "type": "Feature",
                    "properties": {},
                    "geometry": {
                      "type": "Point",
                      "coordinates": [
                        -27.421,
                        -14.944
                      ]
                    }
                  },
                  "id": -1,
                  "value": "Av Medrano 750",
                  "location": "CABA",
                  "comune": 1,
                  "policestation": 1,
                  "createdAt": "2016-12-15T16:06:48.540Z",
                  "updatedAt": "2016-12-15T16:06:48.540Z"
                }
              }
            ],
            "ElectionDayType": {
              "id": 1,
              "name": "Paso",
              "description": "Paso",
              "createdAt": "2016-12-15T16:06:48.325Z",
              "updatedAt": "2016-12-15T16:06:48.325Z"
            }
          }
        ]
      }
    
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment