openapi: 3.1.0
x-stoplight:
  id: 3ppmlligoeepu
info:
  title: Clockings
  version: '1.0'
  summary: API for manage clocking records to the worker in any project
  description: >-
    The clockings endpoint in the Nalanda API is designed to help organizations track employee working hours. This is
    especially useful for complying with labor laws, such as Spain's Royal Decree 8/2019, which mandates accurate
    records of employee timekeeping.


    With this API, developers can easily integrate employee check-in/check-out tracking into their systems. It supports
    basic CRUD operations (Create, Read, Update, Delete) for clocking records and communicates using standard HTTP
    requests and JSON format.
servers:
  - url: https://api.nalandaglobal.com/api
    description: Prod
paths:
  /companies/{tax_id}/clockings:
    parameters:
      - schema:
          type: string
        name: tax_id
        in: path
        required: true
        description: Tax Id of the company
    get:
      summary: Find all clockings by company
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                type: object
                properties:
                  content:
                    x-stoplight:
                      id: z784kzw0ej1eg
                    type: array
                    items:
                      $ref: '#/components/schemas/Clocking'
                      x-stoplight:
                        id: 5zz0bbqhv4vlt
                  page:
                    $ref: ./Page.json
                    x-stoplight:
                      id: up0kj4m5jueqa
        '401':
          $ref: '#/components/responses/401-Unauthorized'
        '403':
          $ref: '#/components/responses/403-Forbidden'
        '404':
          $ref: '#/components/responses/404-Not_Found'
        '406':
          $ref: '#/components/responses/406-Not_Acceptable'
      operationId: get-clockings-by-company
      description: >
        <!-- BEGIN supported-platforms -->

        <!-- theme: none -->

        >#### Supported Platforms: NATIONAL / INTERNATIONAL

        <!-- END supported-platforms -->


        Returns the clocking-in records of the workers belonging to the company identified by tax_id on the date
        specified in the request.
      x-stoplight:
        id: cln9hdqis9vrx
      x-supported-platforms:
        - national
        - international
      security:
        - bearerAuth: []
      parameters:
        - $ref: '#/components/parameters/accept'
        - $ref: '#/components/parameters/page'
        - $ref: '#/components/parameters/size'
        - $ref: '#/components/parameters/sort'
        - schema:
            type: string
            format: date
          in: query
          name: date_at
          description: Date to search
          required: true
  /projects/{id}/clockings:
    parameters:
      - name: id
        in: path
        required: true
        schema:
          type: string
        description: Id of the project
    get:
      summary: Find all clockings by project
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                type: object
                properties:
                  content:
                    type: array
                    items:
                      $ref: '#/components/schemas/Clocking'
                  page:
                    $ref: ./Page.json
        '401':
          $ref: '#/components/responses/401-Unauthorized'
        '403':
          $ref: '#/components/responses/403-Forbidden'
        '404':
          $ref: '#/components/responses/404-Not_Found'
        '406':
          $ref: '#/components/responses/406-Not_Acceptable'
      operationId: get-clockings-by-project
      description: >-
        <!-- BEGIN supported-platforms -->

        <!-- theme: none -->

        >#### Supported Platforms: NATIONAL / INTERNATIONAL

        <!-- END supported-platforms -->


        Returns the clocking-in records of subcontracted workers linked to the project, from the date on which the
        request is made.
      security:
        - bearerAuth: []
      parameters:
        - $ref: '#/components/parameters/accept'
        - $ref: '#/components/parameters/page'
        - $ref: '#/components/parameters/size'
        - $ref: '#/components/parameters/sort'
        - schema:
            type: string
            format: date
          in: query
          name: date_at
          description: Date to search
          required: true
      x-stoplight:
        id: k1e3pqe45qr2q
      x-supported-platforms:
        - national
        - international
components:
  schemas:
    Clocking:
      title: Clocking
      type: object
      x-stoplight:
        id: 1h14vkwovvuh1
      properties:
        worker_id_card:
          type: string
          description: Id card of the worker.
          x-stoplight:
            id: 92asxy4a8bdov
          example: 22835108H
        project_id:
          type: string
          x-stoplight:
            id: 1t8eefw2a22jj
          example: 01H9SN42B2BGZ1JXPN8C7GJJ80
          description: Unique identifier for the given project.
        contractor_id:
          type: string
          x-stoplight:
            id: pz18xquag0a4o
          example: 01H9SN42B4VCWP5SG00S3E9V31
          description: Unique identifier for the given contractor.
        type:
          x-stoplight:
            id: cxlbj5lqa8itk
          enum:
            - IN
            - OUT
          description: Sign in or Sign out
        clocked_at:
          type: string
          format: date-time
          example: '2023-09-01T07:30:00'
          x-stoplight:
            id: 6oug9orjfoau9
          description: Date of the sign
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
  responses:
    401-Unauthorized:
      description: 401 Unauthorized
      content: {}
    404-Not_Found:
      description: 404 Not Found
      content:
        application/json:
          schema:
            properties:
              id:
                type: string
    406-Not_Acceptable:
      description: 406 Not Acceptable
      content:
        application/json:
          schema:
            properties:
              id:
                type: string
    403-Forbidden:
      description: 403 Forbidden
      content:
        application/json:
          schema:
            properties:
              id:
                type: string
  parameters:
    id:
      name: id
      in: path
      required: true
      schema:
        type: string
      description: Tax id of the company
    accept:
      name: Accept
      in: header
      required: false
      schema:
        type: string
      description: application/vnd.nalanda.api-v1.0+json
    page:
      name: page
      in: query
      required: false
      schema:
        type: number
      description: Number of the current page
    size:
      name: size
      in: query
      required: false
      schema:
        type: number
      description: Size for every page
    sort:
      name: sort
      in: query
      required: false
      schema:
        type: string
      description: Sort by field
tags:
  - name: Reports
    description: Reports and exports
security:
  - bearerAuth: []
