Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Comments

Fullstack task#34

Open
VladisB wants to merge 2 commits intoDishboard:main from
VladisB:bykov-fullstack-task
Open

Fullstack task #34
VladisB wants to merge 2 commits intoDishboard:main from
VladisB:bykov-fullstack-task

Conversation

@VladisB
Copy link

@VladisB VladisB commented Jan 20, 2025
edited
Loading

PR: Implement Exchange Rates GraphQL Query & Frontend Display

Overview

This pull request implements the required functionality for fetching, caching, and displaying exchange rates, meeting the provided specifications for both backend and frontend. The changes include:

  • A new GraphQL query on the backend to fetch exchange rates.
  • Integration with the Czech National Bank to get the latest rates.
  • Caching using a Postgres database with a 5-minute lifetime.
  • A simple React frontend displaying the exchange rates and cache age.

Backend Changes

GraphQL Query for Exchange Rates

  • Implementation:
    A new GraphQL query has been added to return a list of exchange rates, integrating NestJS, TypeScript, and GraphQL.

Data Fetching from the Czech National Bank

  • Details:
    The service located in fullstack/task/packages/server/src/services/exchange-rate now retrieves the latest rates from the Czech National Bank website.

Caching with Postgres

  • Mechanism:
    • Fetched exchange rates are saved in the Postgres database using TypeORM.
    • The cache expires after 5 minutes, after which new requests fetch and store fresh data.
    • During the cache lifetime, data is served from the database to reduce external API calls.

Frontend Changes

Exchange Rates Table

  • Implementation:
    A new React component (using TypeScript) has been added to display a table of exchange rates with the following details:
    • Country
    • Currency
    • Amount
    • Code
    • Rate

Cache Timestamp Display

  • Details:
    A section has been added to show how long ago the exchange rates were fetched, based on the cache timestamp. This helps inform users about the data's freshness.

UI examples

Main

Screenshot 2025年01月20日 200558

Timestamp

Screenshot 2025年01月20日 200604

Small UI improvement: dark/light theme

Screenshot 2025年01月20日 201030

Notes

I have some issues with pnp on current machine so just used clasic approach.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

No reviews

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

1 participant

AltStyle によって変換されたページ (->オリジナル) /