From 47e078605e5b01b12c04fd7489543fce56574fd1 Mon Sep 17 00:00:00 2001 From: yukionishi1129 Date: Sun, 31 Mar 2024 22:52:56 +0900 Subject: [PATCH 1/3] fix lint --- batch-service/.golangci.yml | 13 +++++++++++++ batch-service/Makefile | 5 +++++ batch-service/cmd/main.go | 5 +++-- batch-service/cmd/usecase/article.go | 5 +++++ batch-service/cmd/usecase/rss.go | 21 ++++++++++----------- batch-service/server/main.go | 3 ++- 6 files changed, 38 insertions(+), 14 deletions(-) create mode 100644 batch-service/.golangci.yml create mode 100644 batch-service/Makefile diff --git a/batch-service/.golangci.yml b/batch-service/.golangci.yml new file mode 100644 index 00000000..6a514fb4 --- /dev/null +++ b/batch-service/.golangci.yml @@ -0,0 +1,13 @@ +linters-settings: + govet: + check-shadowing: true + golint: + min-confidence: 0.8 +linters: + enable: + - govet + - unused + # - gocritic + - staticcheck + - stylecheck + - errcheck \ No newline at end of file diff --git a/batch-service/Makefile b/batch-service/Makefile new file mode 100644 index 00000000..019984c9 --- /dev/null +++ b/batch-service/Makefile @@ -0,0 +1,5 @@ +empty: + echo "empty" + +lint: + golangci-lint run ./... \ No newline at end of file diff --git a/batch-service/cmd/main.go b/batch-service/cmd/main.go index ad8abaec..ebfc386d 100644 --- a/batch-service/cmd/main.go +++ b/batch-service/cmd/main.go @@ -24,9 +24,10 @@ func main() { return } defer func(client *firestore.Client) { - err := client.Close() + err = client.Close() if err != nil { - + log.Fatalf("Failed to close client: %v", err) + return } }(client) diff --git a/batch-service/cmd/usecase/article.go b/batch-service/cmd/usecase/article.go index 27191f6a..9c267302 100644 --- a/batch-service/cmd/usecase/article.go +++ b/batch-service/cmd/usecase/article.go @@ -39,8 +39,13 @@ func (au *ArticleUsecase) CreateArticles(ctx context.Context, client *firestore. for _, p := range platforms { var wg sync.WaitGroup rss, err := GetRSS(p.RssURL) + if err != nil { + log.Printf("【error get rss】: %s", p.Name) + continue + } articles, err := au.ar.GetArticlesByPlatform(ctx, p.ID) if err != nil { + log.Printf("【error get articles by platform】: %s", p.Name) continue } if err != nil { diff --git a/batch-service/cmd/usecase/rss.go b/batch-service/cmd/usecase/rss.go index 63a05a18..80bee6d5 100644 --- a/batch-service/cmd/usecase/rss.go +++ b/batch-service/cmd/usecase/rss.go @@ -3,7 +3,6 @@ package usecase import ( "fmt" "github.com/Songmu/go-httpdate" - goose "github.com/advancedlogic/GoOse" "github.com/mmcdole/gofeed" "github.com/otiai10/opengraph" ) @@ -63,13 +62,13 @@ func getOGPImage(url string) (string, error) { return "", nil } -func getMetaData(url string) (faviconURL, ogpImageURL string, err error) { - g := goose.New() - article, err := g.ExtractFromURL(url) - if err != nil { - return "", "", err - } - faviconURL = article.MetaFavicon - ogpImageURL = article.TopImage - return faviconURL, ogpImageURL, nil -} +//func getMetaData(url string) (faviconURL, ogpImageURL string, err error) { +// g := goose.New() +// article, err := g.ExtractFromURL(url) +// if err != nil { +// return "", "", err +// } +// faviconURL = article.MetaFavicon +// ogpImageURL = article.TopImage +// return faviconURL, ogpImageURL, nil +//} diff --git a/batch-service/server/main.go b/batch-service/server/main.go index 48e74643..1184996a 100644 --- a/batch-service/server/main.go +++ b/batch-service/server/main.go @@ -41,7 +41,8 @@ func main() { defer func(client *firestore.Client) { err := client.Close() if err != nil { - + log.Fatalf("Failed to close client: %v", err) + return } }(client) From adf2ab7b8419847420142e983a5310c364207a73 Mon Sep 17 00:00:00 2001 From: yukionishi1129 Date: Sun, 31 Mar 2024 22:56:04 +0900 Subject: [PATCH 2/3] ci --- .github/workflows/batch_service_pr_check.yml | 47 ++++++++++++++++++++ 1 file changed, 47 insertions(+) create mode 100644 .github/workflows/batch_service_pr_check.yml diff --git a/.github/workflows/batch_service_pr_check.yml b/.github/workflows/batch_service_pr_check.yml new file mode 100644 index 00000000..82e4315b --- /dev/null +++ b/.github/workflows/batch_service_pr_check.yml @@ -0,0 +1,47 @@ +name: batch_service_pr_check + +on: + push: + branches: + - "main" + - "develop" + - "feature/*" + - "feat/*" + - "YL-*" + paths: + - "batch-service/**" + - ".github/workflows/batch_service_pr_check.yml" + +permissions: + contents: read + +jobs: + build: + runs-on: ubuntu-latest + + strategy: + matrix: + go: ['1.22'] + + defaults: + run: + working-directory: ./batch-service + + steps: + - name: Checkout repository + uses: actions/checkout@v3 + + - name: Setup Go + uses: actions/setup-go@v3 + with: + go-version: ${{ matrix.go }} + cache: false + + - name: Install dependencies + run: go mod download + + - name: Go Lint + run: go install github.com/golangci/golangci-lint/cmd/golangci-lint@latest && make lint + + - name: Go Build + run: go build -v ./... \ No newline at end of file From 750a52f79b9fbd0693b4f1798e229ad937ec2ea9 Mon Sep 17 00:00:00 2001 From: yukionishi1129 Date: Mon, 1 Apr 2024 22:58:02 +0900 Subject: [PATCH 3/3] tailwind fix --- .gitignore | 4 +- supabase/.gitignore | 4 + supabase/config.toml | 161 ++++++++++++++++++ supabase/seed.sql | 0 web/client/.eslintrc.json | 5 +- web/client/package-lock.json | 17 ++ web/client/package.json | 1 + web/client/src/app/(auth)/login/page.tsx | 2 +- web/client/src/app/bookmark/page.tsx | 2 +- web/client/src/app/favorite/page.tsx | 2 +- web/client/src/app/feed/page.tsx | 2 +- web/client/src/app/mypage/page.tsx | 2 +- .../components/layout/BaseLayout/index.tsx | 6 +- .../src/components/layout/Header/index.tsx | 4 +- .../src/components/layout/Sidebar/index.tsx | 2 +- web/client/src/components/ui/button.tsx | 2 +- web/client/src/components/ui/dialog.tsx | 2 +- .../articles/components/ArticleCard.tsx | 14 +- .../articles/components/ArticleDetail.tsx | 6 +- .../components/ArticleDetailDialog.tsx | 16 +- .../articles/components/ArticleList.tsx | 4 +- .../articles/components/LanguageTabMenu.tsx | 2 +- web/client/src/hooks/useParseHtml.tsx | 18 +- 23 files changed, 232 insertions(+), 46 deletions(-) create mode 100644 supabase/.gitignore create mode 100644 supabase/config.toml create mode 100644 supabase/seed.sql diff --git a/.gitignore b/.gitignore index 4dc0fcde..101e84db 100644 --- a/.gitignore +++ b/.gitignore @@ -4,4 +4,6 @@ node_modules -serviceAccountKey.json \ No newline at end of file +serviceAccountKey.json + +.DS_Store \ No newline at end of file diff --git a/supabase/.gitignore b/supabase/.gitignore new file mode 100644 index 00000000..a3ad8805 --- /dev/null +++ b/supabase/.gitignore @@ -0,0 +1,4 @@ +# Supabase +.branches +.temp +.env diff --git a/supabase/config.toml b/supabase/config.toml new file mode 100644 index 00000000..f1d5207c --- /dev/null +++ b/supabase/config.toml @@ -0,0 +1,161 @@ +# A string used to distinguish different Supabase projects on the same host. Defaults to the +# working directory name when running `supabase init`. +project_id = "techpicks" + +[api] +enabled = true +# Port to use for the API URL. +port = 54321 +# Schemas to expose in your API. Tables, views and stored procedures in this schema will get API +# endpoints. public and storage are always included. +schemas = ["public", "storage", "graphql_public"] +# Extra schemas to add to the search_path of every request. public is always included. +extra_search_path = ["public", "extensions"] +# The maximum number of rows returns from a view, table, or stored procedure. Limits payload size +# for accidental or malicious requests. +max_rows = 1000 + +[db] +# Port to use for the local database URL. +port = 54322 +# Port used by db diff command to initialize the shadow database. +shadow_port = 54320 +# The database major version to use. This has to be the same as your remote database's. Run `SHOW +# server_version;` on the remote database to check. +major_version = 15 + +[db.pooler] +enabled = false +# Port to use for the local connection pooler. +port = 54329 +# Specifies when a server connection can be reused by other clients. +# Configure one of the supported pooler modes: `transaction`, `session`. +pool_mode = "transaction" +# How many server connections to allow per user/database pair. +default_pool_size = 20 +# Maximum number of client connections allowed. +max_client_conn = 100 + +[realtime] +enabled = true +# Bind realtime via either IPv4 or IPv6. (default: IPv6) +# ip_version = "IPv6" +# The maximum length in bytes of HTTP request headers. (default: 4096) +# max_header_length = 4096 + +[studio] +enabled = true +# Port to use for Supabase Studio. +port = 54323 +# External URL of the API server that frontend connects to. +api_url = "http://127.0.0.1" +# OpenAI API Key to use for Supabase AI in the Supabase Studio. +openai_api_key = "env(OPENAI_API_KEY)" + +# Email testing server. Emails sent with the local dev setup are not actually sent - rather, they +# are monitored, and you can view the emails that would have been sent from the web interface. +[inbucket] +enabled = true +# Port to use for the email testing server web interface. +port = 54324 +# Uncomment to expose additional ports for testing user applications that send emails. +# smtp_port = 54325 +# pop3_port = 54326 + +[storage] +enabled = true +# The maximum file size allowed (e.g. "5MB", "500KB"). +file_size_limit = "50MiB" + +[auth] +enabled = true +# The base URL of your website. Used as an allow-list for redirects and for constructing URLs used +# in emails. +site_url = "http://127.0.0.1:3000" +# A list of *exact* URLs that auth providers are permitted to redirect to post authentication. +additional_redirect_urls = ["https://127.0.0.1:3000"] +# How long tokens are valid for, in seconds. Defaults to 3600 (1 hour), maximum 604,800 (1 week). +jwt_expiry = 3600 +# If disabled, the refresh token will never expire. +enable_refresh_token_rotation = true +# Allows refresh tokens to be reused after expiry, up to the specified interval in seconds. +# Requires enable_refresh_token_rotation = true. +refresh_token_reuse_interval = 10 +# Allow/disallow new user signups to your project. +enable_signup = true +# Allow/disallow testing manual linking of accounts +enable_manual_linking = false + +[auth.email] +# Allow/disallow new user signups via email to your project. +enable_signup = true +# If enabled, a user will be required to confirm any email change on both the old, and new email +# addresses. If disabled, only the new email is required to confirm. +double_confirm_changes = true +# If enabled, users need to confirm their email address before signing in. +enable_confirmations = false + +# Uncomment to customize email template +# [auth.email.template.invite] +# subject = "You have been invited" +# content_path = "./supabase/templates/invite.html" + +[auth.sms] +# Allow/disallow new user signups via SMS to your project. +enable_signup = true +# If enabled, users need to confirm their phone number before signing in. +enable_confirmations = false +# Template for sending OTP to users +template = "Your code is {{ .Code }} ." + +# Use pre-defined map of phone number to OTP for testing. +[auth.sms.test_otp] +# 4152127777 = "123456" + +# This hook runs before a token is issued and allows you to add additional claims based on the authentication method used. +[auth.hook.custom_access_token] +# enabled = true +# uri = "pg-functions:////" + + +# Configure one of the supported SMS providers: `twilio`, `twilio_verify`, `messagebird`, `textlocal`, `vonage`. +[auth.sms.twilio] +enabled = false +account_sid = "" +message_service_sid = "" +# DO NOT commit your Twilio auth token to git. Use environment variable substitution instead: +auth_token = "env(SUPABASE_AUTH_SMS_TWILIO_AUTH_TOKEN)" + +# Use an external OAuth provider. The full list of providers are: `apple`, `azure`, `bitbucket`, +# `discord`, `facebook`, `github`, `gitlab`, `google`, `keycloak`, `linkedin_oidc`, `notion`, `twitch`, +# `twitter`, `slack`, `spotify`, `workos`, `zoom`. +[auth.external.apple] +enabled = false +client_id = "" +# DO NOT commit your OAuth provider secret to git. Use environment variable substitution instead: +secret = "env(SUPABASE_AUTH_EXTERNAL_APPLE_SECRET)" +# Overrides the default auth redirectUrl. +redirect_uri = "" +# Overrides the default auth provider URL. Used to support self-hosted gitlab, single-tenant Azure, +# or any other third-party OIDC providers. +url = "" + +[analytics] +enabled = false +port = 54327 +vector_port = 54328 +# Configure one of the supported backends: `postgres`, `bigquery`. +backend = "postgres" + +# Experimental features may be deprecated any time +[experimental] +# Configures Postgres storage engine to use OrioleDB (S3) +orioledb_version = "" +# Configures S3 bucket URL, eg. .s3-.amazonaws.com +s3_host = "env(S3_HOST)" +# Configures S3 bucket region, eg. us-east-1 +s3_region = "env(S3_REGION)" +# Configures AWS_ACCESS_KEY_ID for S3 bucket +s3_access_key = "env(S3_ACCESS_KEY)" +# Configures AWS_SECRET_ACCESS_KEY for S3 bucket +s3_secret_key = "env(S3_SECRET_KEY)" diff --git a/supabase/seed.sql b/supabase/seed.sql new file mode 100644 index 00000000..e69de29b diff --git a/web/client/.eslintrc.json b/web/client/.eslintrc.json index 368d0d52..7925767a 100644 --- a/web/client/.eslintrc.json +++ b/web/client/.eslintrc.json @@ -3,9 +3,10 @@ "next/core-web-vitals", "prettier", "plugin:import/recommended", - "plugin:import/warnings" + "plugin:import/warnings", + "plugin:tailwindcss/recommended" ], - "plugins": ["import", "unused-imports"], + "plugins": ["import", "unused-imports", "tailwindcss"], "rules": { "import/order": [ "error", diff --git a/web/client/package-lock.json b/web/client/package-lock.json index b804500e..f6a929f3 100644 --- a/web/client/package-lock.json +++ b/web/client/package-lock.json @@ -45,6 +45,7 @@ "eslint-import-resolver-typescript": "^3.6.1", "eslint-plugin-import": "^2.29.1", "eslint-plugin-simple-import-sort": "^12.0.0", + "eslint-plugin-tailwindcss": "^3.15.1", "eslint-plugin-unused-imports": "^3.1.0", "husky": "^8.0.0", "lint-staged": "^15.2.2", @@ -3980,6 +3981,22 @@ "eslint": ">=5.0.0" } }, + "node_modules/eslint-plugin-tailwindcss": { + "version": "3.15.1", + "resolved": "https://registry.npmjs.org/eslint-plugin-tailwindcss/-/eslint-plugin-tailwindcss-3.15.1.tgz", + "integrity": "sha512-4RXRMIaMG07C2TBEW1k0VM4+dDazz1kxcZhkK4zirvmHGZTA4jnlSO2kq5mamuSPi+Wo17dh2SlC8IyFBuCd7Q==", + "dev": true, + "dependencies": { + "fast-glob": "^3.2.5", + "postcss": "^8.4.4" + }, + "engines": { + "node": ">=12.13.0" + }, + "peerDependencies": { + "tailwindcss": "^3.4.0" + } + }, "node_modules/eslint-plugin-unused-imports": { "version": "3.1.0", "resolved": "https://registry.npmjs.org/eslint-plugin-unused-imports/-/eslint-plugin-unused-imports-3.1.0.tgz", diff --git a/web/client/package.json b/web/client/package.json index 66d904ac..adbd1f92 100644 --- a/web/client/package.json +++ b/web/client/package.json @@ -52,6 +52,7 @@ "eslint-import-resolver-typescript": "^3.6.1", "eslint-plugin-import": "^2.29.1", "eslint-plugin-simple-import-sort": "^12.0.0", + "eslint-plugin-tailwindcss": "^3.15.1", "eslint-plugin-unused-imports": "^3.1.0", "husky": "^8.0.0", "lint-staged": "^15.2.2", diff --git a/web/client/src/app/(auth)/login/page.tsx b/web/client/src/app/(auth)/login/page.tsx index 021a4f51..04ee2767 100644 --- a/web/client/src/app/(auth)/login/page.tsx +++ b/web/client/src/app/(auth)/login/page.tsx @@ -2,7 +2,7 @@ import { LoginForm } from "@/features/auth/LoginForm"; export default function Login() { return ( -
+

Login Page

diff --git a/web/client/src/app/bookmark/page.tsx b/web/client/src/app/bookmark/page.tsx index 59877e1d..6aeba13e 100644 --- a/web/client/src/app/bookmark/page.tsx +++ b/web/client/src/app/bookmark/page.tsx @@ -1,6 +1,6 @@ export default function Bookmark() { return ( -
+

Bookmark Page

diff --git a/web/client/src/app/favorite/page.tsx b/web/client/src/app/favorite/page.tsx index c430ab6a..580d6934 100644 --- a/web/client/src/app/favorite/page.tsx +++ b/web/client/src/app/favorite/page.tsx @@ -1,6 +1,6 @@ export default function Favorite() { return ( -
+

Favorite Page

diff --git a/web/client/src/app/feed/page.tsx b/web/client/src/app/feed/page.tsx index db1f6695..ca04b59d 100644 --- a/web/client/src/app/feed/page.tsx +++ b/web/client/src/app/feed/page.tsx @@ -1,6 +1,6 @@ export default function Feed() { return ( -
+

Feed Page

diff --git a/web/client/src/app/mypage/page.tsx b/web/client/src/app/mypage/page.tsx index 7dce902c..3dd18f71 100644 --- a/web/client/src/app/mypage/page.tsx +++ b/web/client/src/app/mypage/page.tsx @@ -1,6 +1,6 @@ export default function MyPage() { return ( -
+

Mypage Page

diff --git a/web/client/src/components/layout/BaseLayout/index.tsx b/web/client/src/components/layout/BaseLayout/index.tsx index bac279d3..8a71579d 100644 --- a/web/client/src/components/layout/BaseLayout/index.tsx +++ b/web/client/src/components/layout/BaseLayout/index.tsx @@ -12,11 +12,11 @@ export const BaseLayout = ({ children }: { children: ReactNode }) => {
-
+
-
-
{children}
+
+
{children}
); diff --git a/web/client/src/components/layout/Header/index.tsx b/web/client/src/components/layout/Header/index.tsx index d5321489..b106a0fe 100644 --- a/web/client/src/components/layout/Header/index.tsx +++ b/web/client/src/components/layout/Header/index.tsx @@ -9,9 +9,9 @@ import { NotLoggedMenu } from "./NotLoggedMenu"; export async function Header() { const session = await getServerSession(authOptions); return ( -
+
-

Tech Picks

+

Tech Picks

diff --git a/web/client/src/components/layout/Sidebar/index.tsx b/web/client/src/components/layout/Sidebar/index.tsx index 26178171..982422d6 100644 --- a/web/client/src/components/layout/Sidebar/index.tsx +++ b/web/client/src/components/layout/Sidebar/index.tsx @@ -2,7 +2,7 @@ import Link from "next/link"; export function Sidebar() { return ( -
+

diff --git a/web/client/src/components/ui/button.tsx b/web/client/src/components/ui/button.tsx index 955f35c5..1d51bae7 100644 --- a/web/client/src/components/ui/button.tsx +++ b/web/client/src/components/ui/button.tsx @@ -23,7 +23,7 @@ const buttonVariants = cva( default: "h-10 px-4 py-2", sm: "h-9 rounded-md px-3", lg: "h-11 rounded-md px-8", - icon: "h-10 w-10", + icon: "size-10", }, }, defaultVariants: { diff --git a/web/client/src/components/ui/dialog.tsx b/web/client/src/components/ui/dialog.tsx index a2bb89fe..d09adfcf 100644 --- a/web/client/src/components/ui/dialog.tsx +++ b/web/client/src/components/ui/dialog.tsx @@ -45,7 +45,7 @@ const DialogContent = React.forwardRef< > {children} - + Close diff --git a/web/client/src/features/articles/components/ArticleCard.tsx b/web/client/src/features/articles/components/ArticleCard.tsx index 0cdb52c8..2aa11fba 100644 --- a/web/client/src/features/articles/components/ArticleCard.tsx +++ b/web/client/src/features/articles/components/ArticleCard.tsx @@ -17,23 +17,23 @@ export const ArticleCard: FC = ({ }: ArticleCardProps) => { const imageUrl = useCheckImageExist(article.thumbnailURL); return ( -
+
-

+

{article.title}

- + {article.platform.name} {article.platform.categoryName && ( - + {article.platform.categoryName} )} @@ -43,9 +43,9 @@ export const ArticleCard: FC = ({
-
+
diff --git a/web/client/src/features/articles/components/ArticleDetail.tsx b/web/client/src/features/articles/components/ArticleDetail.tsx index 763e88c9..71ccedfa 100644 --- a/web/client/src/features/articles/components/ArticleDetail.tsx +++ b/web/client/src/features/articles/components/ArticleDetail.tsx @@ -30,7 +30,7 @@ export const ArticleDetail = ({ article }: ArticleDetailProps) => {
@@ -50,7 +50,7 @@ export const ArticleDetail = ({ article }: ArticleDetailProps) => { href={article.platform.siteUrl} target="_blank" > - + {article.platform.name} @@ -67,7 +67,7 @@ export const ArticleDetail = ({ article }: ArticleDetailProps) => { diff --git a/web/client/src/features/articles/components/ArticleDetailDialog.tsx b/web/client/src/features/articles/components/ArticleDetailDialog.tsx index 03a461d7..7066c2a9 100644 --- a/web/client/src/features/articles/components/ArticleDetailDialog.tsx +++ b/web/client/src/features/articles/components/ArticleDetailDialog.tsx @@ -35,13 +35,13 @@ export const ArticleDetailDialog: FC = ({ - + {open && } @@ -71,15 +71,15 @@ const ArticleContent = ({ article }: { article: Article }) => { target="_blank" > - + {article.platform.name} {article.platform.categoryName && ( - + {article.platform.categoryName} )} @@ -95,7 +95,7 @@ const ArticleContent = ({ article }: { article: Article }) => {
@@ -105,7 +105,7 @@ const ArticleContent = ({ article }: { article: Article }) => { @@ -120,7 +120,7 @@ const ArticleContent = ({ article }: { article: Article }) => { diff --git a/web/client/src/features/articles/components/ArticleList.tsx b/web/client/src/features/articles/components/ArticleList.tsx index f146d05c..eb3c9b53 100644 --- a/web/client/src/features/articles/components/ArticleList.tsx +++ b/web/client/src/features/articles/components/ArticleList.tsx @@ -84,10 +84,10 @@ export function ArticleList({ return (
-
+
-
+
{flatArticles && flatArticles.map((article) => (
diff --git a/web/client/src/features/articles/components/LanguageTabMenu.tsx b/web/client/src/features/articles/components/LanguageTabMenu.tsx index 5f7e0e80..5f526c75 100644 --- a/web/client/src/features/articles/components/LanguageTabMenu.tsx +++ b/web/client/src/features/articles/components/LanguageTabMenu.tsx @@ -34,7 +34,7 @@ export const LanguageTabMenu: FC = ({