Skip to content

[Feature]: Convert all timestamps to date #2187

@forgetso

Description

@forgetso

✨ Feature Request

Description

There are many places where timestamps are used instead of dates in the database. For example, requestedAtTimestamp and lastUpdatedTimestamp. These should all be converted to dates and any logic that is dependent on timestamps updated accordingly.

Files that will need updated are:

./packages/provider/coverage/src/tasks/powCaptcha/powTasks.ts.html
./packages/provider/coverage/src/tasks/client/clientTasks.ts.html
./packages/provider/coverage/src/tasks/imgCaptcha/imgCaptchaTasks.ts.html
./packages/provider/coverage/src/api/captcha.ts.html
./packages/provider/src/tests/unit/tasks/powCaptcha/powTasks.unit.test.ts
./packages/provider/src/tests/unit/tasks/client/clientTasks.unit.test.ts
./packages/provider/src/tests/unit/tasks/imgCaptcha/imgCaptchaTasks.unit.test.ts
./packages/provider/src/tasks/powCaptcha/powTasks.ts
./packages/provider/src/tasks/client/clientTasks.ts
./packages/provider/src/tasks/imgCaptcha/imgCaptchaTasks.ts
./packages/provider/src/api/captcha.ts
./packages/types-database/src/provider/pendingCaptchaRequest.ts
./packages/types-database/src/types/provider.ts
./packages/types-database/src/types/client.ts
./packages/database/src/databases/provider.ts
./packages/database/src/databases/client.ts
./packages/types/src/client/user.ts
./packages/types/src/datasets/captcha.ts

Requirements:

  • Update all timestamps to dates in both the database and javascript
  • Where timestamps are still required, ensure a timestamp is used (e.g. ${requestedAtTimestamp}${POW_SEPARATOR}${userAccount}${POW_SEPARATOR}${pair.address}; will still require a timestamp)

Testing:

  1. To setup the dev environment, start docker:
        docker compose --file docker/docker-compose.development.yml up -d --force-recreate --remove-orphans

  1. Then setup env:
          cp demos/client-example-server/env.development demos/client-example-server/.env.test
          cp demos/client-bundle-example/env.development demos/client-bundle-example/.env.test
          cp dev/scripts/env.test .env.test
          cp dev/scripts/env.test dev/scripts/.env.test
          cp dev/scripts/env.test packages/cli/.env.test
          cp dev/scripts/env.test packages/procaptcha-bundle/.env.test

          NODE_ENV="test" npm run setup

          echo NODE_ENV: "$NODE_ENV"
  1. Run the tests
          npx concurrently \
            "NODE_ENV=test npm run start:provider" \
            "sleep 10s && NODE_ENV=test npm run test:all" \
            --success "first" --kill-others

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions