From a586ef5c7369c28511fbda201677330b7dafd939 Mon Sep 17 00:00:00 2001 From: Preschian Febryantara Date: Sun, 1 Dec 2024 18:41:17 +0700 Subject: [PATCH 1/3] docs: update arch diagram in general --- services/ogi-route/README.md | 65 +++++++++++++++++++++++++++++++----- 1 file changed, 57 insertions(+), 8 deletions(-) diff --git a/services/ogi-route/README.md b/services/ogi-route/README.md index c7afc73..cd7e0e6 100644 --- a/services/ogi-route/README.md +++ b/services/ogi-route/README.md @@ -23,11 +23,60 @@ Better alternative implementation: ## Architecture diagram ```mermaid - graph LR; - user --> koda.art - koda.art -- assigned routes --> ogi-route{{ogi-route}} - koda.art -- routes doesn't match --> nft-gallery{{nft-gallery}} - ogi-route --> isbot - isbot -- true --> ogi{{ogi}} - isbot -- false --> nft-gallery -``` +graph LR + A[User] --> B[koda.art] + B --> C{ogi-route} + C -->|SEO sensitive paths| D[ogi] + C -->|All other routes| E[nft-gallery] + E -->|For generative art| F[dyndata] + E -->|For generative art| G[fxart] + E -->|NFT & contract info| M[oda] + + F -->|Generate| H[Dynamic ID for substrate] + F -->|Generate| I[Dynamic metadata] + F -->|/image| O{Cache exists?} + O -->|Yes| P[Return from R2 bucket] + O -->|No| Q[Capture service] + Q --> R[Store in R2 bucket] + R --> P + + G -->|Generate| J[Dynamic ID for substrate] + G -->|Generate| K[Dynamic metadata] + G -->|Schedule| L[Calendar endpoints] + + M -->|Unified endpoint| N[Substrate & EVM NFT
and contract details] + + style C fill:#f9f,stroke:#333,stroke-width:2px + style D fill:#bbf,stroke:#333,stroke-width:2px + style E fill:#bfb,stroke:#333,stroke-width:2px + style F fill:#fbb,stroke:#333,stroke-width:2px + style G fill:#fbb,stroke:#333,stroke-width:2px + style M fill:#bff,stroke:#333,stroke-width:2px + style O fill:#fcf,stroke:#333,stroke-width:2px + style Q fill:#cff,stroke:#333,stroke-width:2px + + classDef note fill:#fff,stroke:#333,stroke-width:1px,stroke-dasharray: 5 5; + classDef endpoint fill:#ffe,stroke:#333,stroke-width:1px; + classDef storage fill:#ffd,stroke:#333,stroke-width:2px; + + N1[SEO sensitive paths
e.g., /gallery, /collection]:::note + N2[Main gallery for
user interactions]:::note + N3[Generative art
components]:::note + N4[Unified NFT &
contract info service]:::note + + H:::endpoint + I:::endpoint + J:::endpoint + K:::endpoint + L:::endpoint + N:::endpoint + P:::storage + R:::storage + + N1 -.-> C + N2 -.-> E + N3 -.-> F + N3 -.-> G + N4 -.-> M + +``` \ No newline at end of file From 58bbfe846d9b5b5d078b17de46872c889dd47c59 Mon Sep 17 00:00:00 2001 From: Preschian Febryantara Date: Sun, 1 Dec 2024 18:48:32 +0700 Subject: [PATCH 2/3] test(type-endpoint): fix test to expect direct success response --- .../image/src/tests/type-endpoint.test.ts | 23 ++++--------------- 1 file changed, 4 insertions(+), 19 deletions(-) diff --git a/services/image/src/tests/type-endpoint.test.ts b/services/image/src/tests/type-endpoint.test.ts index 47f22f3..5d4fc3e 100644 --- a/services/image/src/tests/type-endpoint.test.ts +++ b/services/image/src/tests/type-endpoint.test.ts @@ -47,32 +47,17 @@ test('type-endpoint - 200 - json', async () => { `) }) -test('type-endpoint - 302 - image', async () => { +test.only('type-endpoint - 302 - image', async () => { const res = await fetch( 'https://image-beta.w.kodadot.xyz/type/endpoint/https://polkadot-data.s3.us-east-2.amazonaws.com/metadata/nfts-88/nfts-88_collection-img.png', { redirect: 'manual' } ) - expect(res.ok).toBe(false) - expect(res.status).toBe(302) + expect(res.ok).toBe(true) + expect(res.status).toBe(200) const redirectURL = res.headers.get('location') - expect(redirectURL).toBe( - 'https://imagedelivery.net/jk5b6spi_m_-9qC4VTnjpg/https---polkadot-data-s3-us-east-2-amazonaws-com-metadata-nfts-88-nfts-88-collection-img-png/public' - ) - - const res2 = await fetch(redirectURL) - expect(res2.ok).toBe(true) - expect(res2.headers.get('content-type')).toBe('image/png') - - const data = await res2.blob() - expect(data).toMatchInlineSnapshot(` - Blob { - Symbol(kHandle): Blob {}, - Symbol(kLength): 86717, - Symbol(kType): "image/png", - } - `) + expect(redirectURL).toBe(null) }) test('type-endpoint - 200 - image - original', async () => { From b3d2472e67a4e1899980bd2f2f00c455c3204ffa Mon Sep 17 00:00:00 2001 From: Preschian Febryantara Date: Sun, 1 Dec 2024 18:50:00 +0700 Subject: [PATCH 3/3] test(scope): update test status code for image type-endpoint --- services/image/src/tests/type-endpoint.test.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/services/image/src/tests/type-endpoint.test.ts b/services/image/src/tests/type-endpoint.test.ts index 5d4fc3e..ec574c0 100644 --- a/services/image/src/tests/type-endpoint.test.ts +++ b/services/image/src/tests/type-endpoint.test.ts @@ -47,7 +47,7 @@ test('type-endpoint - 200 - json', async () => { `) }) -test.only('type-endpoint - 302 - image', async () => { +test('type-endpoint - 200 - image', async () => { const res = await fetch( 'https://image-beta.w.kodadot.xyz/type/endpoint/https://polkadot-data.s3.us-east-2.amazonaws.com/metadata/nfts-88/nfts-88_collection-img.png', { redirect: 'manual' }