Skip to content

Commit

Permalink
Merge pull request #18 from YukiOnishi1129/feat/YL-49
Browse files Browse the repository at this point in the history
Feat/yl 49
  • Loading branch information
YukiOnishi1129 authored Apr 1, 2024
2 parents 45f5108 + 750a52f commit bac5d74
Show file tree
Hide file tree
Showing 30 changed files with 317 additions and 60 deletions.
47 changes: 47 additions & 0 deletions .github/workflows/batch_service_pr_check.yml
Original file line number Diff line number Diff line change
@@ -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 ./...
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,6 @@

node_modules

serviceAccountKey.json
serviceAccountKey.json

.DS_Store
13 changes: 13 additions & 0 deletions batch-service/.golangci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
linters-settings:
govet:
check-shadowing: true
golint:
min-confidence: 0.8
linters:
enable:
- govet
- unused
# - gocritic
- staticcheck
- stylecheck
- errcheck
5 changes: 5 additions & 0 deletions batch-service/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
empty:
echo "empty"

lint:
golangci-lint run ./...
5 changes: 3 additions & 2 deletions batch-service/cmd/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down
5 changes: 5 additions & 0 deletions batch-service/cmd/usecase/article.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
21 changes: 10 additions & 11 deletions batch-service/cmd/usecase/rss.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
)
Expand Down Expand Up @@ -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
//}
3 changes: 2 additions & 1 deletion batch-service/server/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down
4 changes: 4 additions & 0 deletions supabase/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# Supabase
.branches
.temp
.env
161 changes: 161 additions & 0 deletions supabase/config.toml
Original file line number Diff line number Diff line change
@@ -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://<database>/<schema>/<hook_name>"


# 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. <bucket_name>.s3-<region>.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)"
Empty file added supabase/seed.sql
Empty file.
5 changes: 3 additions & 2 deletions web/client/.eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
17 changes: 17 additions & 0 deletions web/client/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions web/client/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
2 changes: 1 addition & 1 deletion web/client/src/app/(auth)/login/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { LoginForm } from "@/features/auth/LoginForm";

export default function Login() {
return (
<div className="w-[40%] mx-auto mt-20 p-4 border-2 border-gray-300 rounded-md shadow-md">
<div className="mx-auto mt-20 w-2/5 rounded-md border-2 border-gray-300 p-4 shadow-md">
<h2 className="text-center text-2xl font-bold text-gray-800">
Login Page
</h2>
Expand Down
2 changes: 1 addition & 1 deletion web/client/src/app/bookmark/page.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
export default function Bookmark() {
return (
<div className="w-[40%] mx-auto mt-20 p-4 border-2 border-gray-300 rounded-md shadow-md">
<div className="mx-auto mt-20 w-2/5 rounded-md border-2 border-gray-300 p-4 shadow-md">
<h2 className="text-center text-2xl font-bold text-gray-800">
Bookmark Page
</h2>
Expand Down
2 changes: 1 addition & 1 deletion web/client/src/app/favorite/page.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
export default function Favorite() {
return (
<div className="w-[40%] mx-auto mt-20 p-4 border-2 border-gray-300 rounded-md shadow-md">
<div className="mx-auto mt-20 w-2/5 rounded-md border-2 border-gray-300 p-4 shadow-md">
<h2 className="text-center text-2xl font-bold text-gray-800">
Favorite Page
</h2>
Expand Down
Loading

0 comments on commit bac5d74

Please sign in to comment.