Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Staging #54

Merged
merged 27 commits into from
Sep 30, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 20 additions & 20 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -1,22 +1,22 @@
module.exports = {
parser: '@typescript-eslint/parser',
parserOptions: {
project: 'tsconfig.json',
tsconfigRootDir: __dirname,
sourceType: 'module',
},
plugins: ['@typescript-eslint/eslint-plugin'],
extends: ['plugin:@typescript-eslint/recommended'],
root: true,
env: {
node: true,
jest: true,
},
ignorePatterns: ['.eslintrc.js'],
rules: {
'@typescript-eslint/interface-name-prefix': 'off',
'@typescript-eslint/explicit-function-return-type': 'off',
'@typescript-eslint/explicit-module-boundary-types': 'off',
'@typescript-eslint/no-explicit-any': 'off',
},
parser: '@typescript-eslint/parser',
parserOptions: {
project: 'tsconfig.json',
tsconfigRootDir: __dirname,
sourceType: 'module',
},
plugins: ['@typescript-eslint/eslint-plugin'],
extends: ['plugin:@typescript-eslint/recommended'],
root: true,
env: {
node: true,
jest: true,
},
ignorePatterns: ['.eslintrc.js', '**/test/*'],
rules: {
'@typescript-eslint/interface-name-prefix': 'off',
'@typescript-eslint/explicit-function-return-type': 'off',
'@typescript-eslint/explicit-module-boundary-types': 'off',
'@typescript-eslint/no-explicit-any': 'off',
},
};
3 changes: 1 addition & 2 deletions docker-compose-hasura.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
version: '3.6'
services:
postgres:
image: postgres:15
Expand Down Expand Up @@ -29,7 +28,7 @@ services:
## uncomment next line to set an admin secret
HASURA_GRAPHQL_ADMIN_SECRET: z6KTncr37daLn5Vq
HASURA_GRAPHQL_METADATA_DEFAULTS: '{"backend_configs":{"dataconnector":{"athena":{"uri":"http://data-connector-agent:8081/api/v1/athena"},"mariadb":{"uri":"http://data-connector-agent:8081/api/v1/mariadb"},"mysql8":{"uri":"http://data-connector-agent:8081/api/v1/mysql"},"oracle":{"uri":"http://data-connector-agent:8081/api/v1/oracle"},"snowflake":{"uri":"http://data-connector-agent:8081/api/v1/snowflake"}}}}'
HASURA_GRAPHQL_JWT_SECRET: '{"type": "RS256", "key": "-----BEGIN RSA PUBLIC KEY-----\nMIIBCgKCAQEAu4H5cKl1P1wnZB9mUgLjUAtyA7kmlzlJwXwUBwPIInxP3kKWJIF8\no4oW4EO5d75qeRjUueYPVh6WCe0OHrOyoFNcd0VsTkuYVMyXlPYlQM1HmBA64b5r\nC7nmr+mk4xlBE6i3EPx1kQAUJTR147WqeFvS3PeWaQVwocffb1KZjfVks3+3WOYA\nNkxoYiDmxGwi+MShzOSyvYizxBHPFm8WgTUhHWPiBCHkX+CRXlz3R7k2nDVxnD7s\nnDDJ8ITxxeY3DJVH4qvARNE+cbFyLbQsmnw72zzsBQmuTt7qLXdQlEmYxxgBZceE\nilkPJOtV11LM/S/CzZOkYZg+Df2F9+PggwIDAQAB\n-----END RSA PUBLIC KEY-----"}'
HASURA_GRAPHQL_JWT_SECRET: '{"type": "RS256", "key": "-----BEGIN RSA PUBLIC KEY-----\nMIIBCgKCAQEAs4q6OBeCTUhVWUTGa3+uw7d2lWbPrIKjU2hvSlvOQE1SIK0AtUP+\nTagi2xIQpNj05j+yb8hh2fX0SqcWmTBGkZksMecesThpYd+YQ30yDHGoI8F70l8D\nRbytmO6habfPqjx1qvXYUscyWycDZyEM0KIxvgQhhR/Nf1CfReIMHmFQtgmTIRnZ\n6nwHXVrHBbVN5LtUYuY4QNpILgwDH0mJAQ0//Fasr0vq5WwkEHlJ5Grzv1jkl6Y8\nERvaNhfvh4vm2lSiS6RkwgWB6wvdNKy2j1AxKmHl2Xdt9aoGsqC5G8nvrmICeEgL\nFTMpJ+nswMIpDqSmYhoraMmnUqoAvNegNwIDAQAB\n-----END RSA PUBLIC KEY-----"}'
HASURA_GRAPHQL_UNAUTHORIZED_ROLE: 'anonymous'
ACTION_API_DOMAIN: 'http://172.27.10.137:3000'
# HASURA_GRAPHQL_ENABLED_APIS: graphql
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@ select_permissions:
- revoked_timestamp
- roles
- signup_methods
- ton_wallet_address
- updated_at
- wallet_address
computed_fields:
Expand All @@ -109,6 +110,7 @@ update_permissions:
- gender
- nickname
- picture
- ton_wallet_address
- wallet_address
filter:
id:
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
table:
name: top_creator_donate
schema: public
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
table:
name: top_user_donate
schema: public
2 changes: 2 additions & 0 deletions hasura/metadata/databases/punkga-pg/tables/tables.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,8 @@
- "!include public_telegram_quest_history.yaml"
- "!include public_telegram_quests.yaml"
- "!include public_telegram_users.yaml"
- "!include public_top_creator_donate.yaml"
- "!include public_top_user_donate.yaml"
- "!include public_user_campaign.yaml"
- "!include public_user_campaign_reward.yaml"
- "!include public_user_level.yaml"
Expand Down
251 changes: 126 additions & 125 deletions hasura/metadata/query_collections.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1077,118 +1077,6 @@
}
}
}
- name: User - Get Profile
query: |
query GetUserProfile {
authorizer_users(limit: 1) {
id
email
email_verified_at
bio
birthdate
gender
active_wallet_address: active_evm_address
wallet_address
nickname
picture
signup_methods
levels {
xp
level
user_level_chain {
id
name
punkga_config
}
}
authorizer_users_user_wallet {
address
}
user_quests_aggregate {
aggregate {
count
}
}
user_quests(order_by: {created_at:desc}, limit: 20) {
created_at
status
user_quest_rewards {
tx_hash
}
quest {
id
name
quests_campaign {
campaign_chain {
punkga_config
}
}
quests_i18n {
id
quest_id
language_id
data
i18n_language {
id
description
icon
is_main
symbol
}
}
reward
}
}
}
}
- name: Public - Get manga by creator
query: |
query manga ($id: Int!, $limit: Int = 10, $offset: Int = 0) {
manga(limit: $limit, offset: $offset, where: {manga_creators:{creator_id:{_eq:$id}},status:{_neq:"Removed"}}) {
id
slug
status
poster
banner
manga_creators {
creator {
name
pen_name
id
slug
isActive
}
}
manga_total_likes {
likes
}
manga_total_views {
views
}
manga_tags {
tag {
tag_languages {
language_id
value
}
id
}
}
chapters(limit: 1, order_by: {chapter_number:desc}, where: {status:{_eq:"Published"}}) {
id
chapter_number
chapter_name
}
contract_addresses
manga_languages {
id
is_main_language
title
description
language_id
}
}
}
- name: Public - query artwork by creator
query: |
query artworks ($creator_id: Int!, $limit: Int = 10, $offset: Int = 0) {
Expand Down Expand Up @@ -1472,40 +1360,153 @@
}
}
}
- name: Public - Query albums by creator id
query: |
query albums ($creator_id: Int!, $limit: Int = 100, $offset: Int = 0) {
albums(where: {_or:[{_and:{id:{_eq:1},show:{_eq:true}}},{_and:{creator_id:{_eq:$creator_id},show:{_eq:true}}}]}, limit: $limit, offset: $offset) {
id
show
thumbnail_url
name
disable
}
albums_aggregate(where: {_or:[{_and:{id:{_eq:1},show:{_eq:true}}},{_and:{creator_id:{_eq:$creator_id},show:{_eq:true}}}]}) {
aggregate {
count
}
}
}
- name: Public - Query album detail
query: |
query albums ($id: Int!, $limit: Int = 10, $offset: Int = 0) {
query albums ($id: Int!, $limit: Int = 10, $offset: Int = 0, $creator_id: Int!) {
albums(where: {id:{_eq:$id},show:{_eq:true},disable:{_eq:false}}) {
id
name
thumbnail_url
show
disable
artworks(limit: $limit, offset: $offset) {
artworks(limit: $limit, offset: $offset, where: {creator_id:{_eq:$creator_id}}) {
id
name
url
}
artworks_aggregate {
artworks_aggregate(where: {creator_id:{_eq:$creator_id}}) {
aggregate {
count
}
}
}
}
- name: Public - Query albums by creator id
- name: Public - Get manga by creator
query: |
query albums ($creator_id: Int!, $limit: Int = 100, $offset: Int = 0) {
albums(where: {_or:[{_and:{id:{_eq:1},show:{_eq:true}}},{_and:{creator_id:{_eq:$creator_id},show:{_eq:true}}}]}, limit: $limit, offset: $offset) {
query manga ($id: Int!, $limit: Int = 10, $offset: Int = 0) {
manga(limit: $limit, offset: $offset, where: {manga_creators:{creator_id:{_eq:$id}},status:{_neq:"Removed"}}) {
id
show
thumbnail_url
name
disable
slug
status
poster
banner
manga_creators {
creator {
name
pen_name
id
slug
isActive
}
}
manga_total_likes {
likes
}
manga_total_views {
views
}
manga_tags {
tag {
tag_languages {
language_id
value
}
id
}
}
chapters(limit: 1, order_by: {chapter_number:desc}, where: {status:{_eq:"Published"}}) {
id
chapter_number
chapter_name
}
contract_addresses
manga_languages {
id
is_main_language
title
description
language_id
}
}
albums_aggregate(where: {_or:[{_and:{id:{_eq:1},show:{_eq:true}}},{_and:{creator_id:{_eq:$creator_id},show:{_eq:true}}}]}) {
aggregate {
count
}
- name: User - Get Profile
query: |
query GetUserProfile {
authorizer_users(limit: 1) {
id
email
email_verified_at
bio
birthdate
gender
active_wallet_address: active_evm_address
wallet_address
ton_wallet_address
nickname
picture
signup_methods
levels {
xp
level
user_level_chain {
id
name
punkga_config
}
}
authorizer_users_user_wallet {
address
}
user_quests_aggregate {
aggregate {
count
}
}
user_quests(order_by: {created_at:desc}, limit: 20) {
created_at
status
user_quest_rewards {
tx_hash
}
quest {
id
name
quests_campaign {
campaign_chain {
punkga_config
}
}
quests_i18n {
id
quest_id
language_id
data
i18n_language {
id
description
icon
is_main
symbol
}
}
reward
}
}
}
}
12 changes: 12 additions & 0 deletions hasura/migrations/punkga-pg/1726730858341_top_user_donate/down.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
-- Could not auto-generate a down migration.
-- Please write an appropriate down migration for the SQL below:
-- CREATE OR REPLACE VIEW "public"."top_user_donate" AS
-- SELECT
-- telegram_users.username,
-- telegram_users.user_id,
-- donate_history.telegram_id,
-- sum(donate_history.value) AS value
-- FROM donate_history
-- INNER JOIN telegram_users on telegram_users.telegram_id = donate_history.telegram_id
-- GROUP BY telegram_users.username,telegram_users.user_id,donate_history.telegram_id
-- LIMIT 10;
10 changes: 10 additions & 0 deletions hasura/migrations/punkga-pg/1726730858341_top_user_donate/up.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
CREATE OR REPLACE VIEW "public"."top_user_donate" AS
SELECT
telegram_users.username,
telegram_users.user_id,
donate_history.telegram_id,
sum(donate_history.value) AS value
FROM donate_history
INNER JOIN telegram_users on telegram_users.telegram_id = donate_history.telegram_id
GROUP BY telegram_users.username,telegram_users.user_id,donate_history.telegram_id
LIMIT 10;
Loading
Loading