Skip to content

Commit

Permalink
add chapter archive count
Browse files Browse the repository at this point in the history
  • Loading branch information
boyangwang committed Jul 12, 2023
1 parent 28467c7 commit c42c267
Show file tree
Hide file tree
Showing 10 changed files with 7,831 additions and 11 deletions.
11 changes: 6 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,10 @@
Palette: #F4E285 #F4A259 #7A4419 #755C1B

# TODOs
[ ] chapter要加数量呀
[ ] I need to fix the broken APIs, using serverless functions

[] dev env
[x] dev env
- 本地nginx, 能跑起来, 有数据 (archives.json也用本地版本)
- 点赞数, 要有接口. 要起lanting-server (mysql). 有没有不用的办法... 好像没有. 也可以放弃点赞这个功能
- search keywords, 有接口
Expand All @@ -16,10 +17,10 @@ Palette: #F4E285 #F4A259 #7A4419 #755C1B
[x] 原文图标需要一点空格
[x] 标签, 有一个空
[x] 原文 for Book, 用豆瓣页面吧
[] Work on server
[] New get latest id
[] 接口很慢. 不要等接口, 先展示 (按ID倒序), 然后re-sort
[] compile archives, 在更新archives.json的时候, 得用DB的origs. 不是本地. 要不然服务器端根本对不了
[x] Work on server
[x] New get latest id
[x] 接口很慢. 不要等接口, 先展示 (按ID倒序), 然后re-sort
[x] compile archives, 在更新archives.json的时候, 得用DB的origs. 不是本地. 要不然服务器端根本对不了

# Workflow
[x] 日期特殊排序
Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@
"use-merge-value": "^1.0.1"
},
"devDependencies": {
"@vercel/node": "^2.15.3",
"@ant-design/pro-cli": "^1.0.18",
"@commitlint/cli": "^12.1.4",
"@commitlint/config-conventional": "^12.1.4",
Expand Down
12 changes: 12 additions & 0 deletions scripts/ddl/2_article_likes.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
CREATE TABLE article_likes
(
id BIGINT AUTO_INCREMENT NOT NULL,
article_id BIGINT NOT NULL,
client_id VARCHAR(256) NOT NULL,
created_at BIGINT NOT NULL,
is_like tinyint(1) NOT NULL DEFAULT 1,
PRIMARY KEY (id),
INDEX ARTICLE_ID_IS_LIKE (article_id, is_like)
) Engine = INNODB
AUTO_INCREMENT = 1000000
DEFAULT CHARSET = utf8mb4;
12 changes: 12 additions & 0 deletions scripts/ddl/3_search_keywords.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
CREATE TABLE search_keywords
(
id BIGINT AUTO_INCREMENT NOT NULL,
search_count INT NOT NULL,
keyword VARCHAR(256) NOT NULL,
created_at BIGINT NOT NULL,
updated_at BIGINT NOT NULL,
PRIMARY KEY (id),
INDEX KEYWORD (keyword)
) Engine = INNODB
AUTO_INCREMENT = 1000000
DEFAULT CHARSET = utf8mb4;
76 changes: 76 additions & 0 deletions scripts/ddl/4_archive_main_tables.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
-- ----------------------------
-- Table structure for archive_authors
-- ----------------------------
DROP TABLE IF EXISTS `archive_authors`;
CREATE TABLE `archive_authors`
(
`archive_id` bigint(20) NOT NULL,
`author` varchar(60) CHARACTER SET utf8mb4 NOT NULL DEFAULT '',
PRIMARY KEY (`archive_id`, `author`)
) ENGINE = InnoDB
DEFAULT CHARSET = utf8mb4;

-- ----------------------------
-- Table structure for archive_origs
-- ----------------------------
DROP TABLE IF EXISTS `archive_origs`;
CREATE TABLE `archive_origs`
(
`archive_id` bigint(20) NOT NULL,
`orig` varchar(255) CHARACTER SET utf8mb4 NOT NULL,
PRIMARY KEY (`archive_id`, `orig`)
) ENGINE = InnoDB
DEFAULT CHARSET = utf8mb4;

-- ----------------------------
-- Table structure for archive_publishers
-- ----------------------------
DROP TABLE IF EXISTS `archive_publishers`;
CREATE TABLE `archive_publishers`
(
`archive_id` bigint(20) NOT NULL,
`publisher` varchar(60) CHARACTER SET utf8mb4 NOT NULL DEFAULT '',
PRIMARY KEY (`archive_id`, `publisher`)
) ENGINE = InnoDB
DEFAULT CHARSET = utf8mb4;

-- ----------------------------
-- Table structure for archive_remarks
-- ----------------------------
DROP TABLE IF EXISTS `archive_remarks`;
CREATE TABLE `archive_remarks`
(
`archive_id` bigint(20) NOT NULL,
`remarks` mediumtext CHARACTER SET utf8mb4 NOT NULL,
PRIMARY KEY (`archive_id`)
) ENGINE = InnoDB
DEFAULT CHARSET = utf8mb4;

-- ----------------------------
-- Table structure for archive_tags
-- ----------------------------
DROP TABLE IF EXISTS `archive_tags`;
CREATE TABLE `archive_tags`
(
`archive_id` bigint(20) NOT NULL,
`tag` varchar(60) CHARACTER SET utf8mb4 NOT NULL DEFAULT '',
PRIMARY KEY (`archive_id`, `tag`)
) ENGINE = InnoDB
DEFAULT CHARSET = utf8mb4;

-- ----------------------------
-- Table structure for archives
-- ----------------------------
DROP TABLE IF EXISTS `archives`;
CREATE TABLE `archives`
(
`id` bigint(20) NOT NULL,
`created_at` bigint(20) NOT NULL,
`updated_at` bigint(20) NOT NULL,
`title` varchar(255) NOT NULL DEFAULT '',
`publish_year` smallint(4) unsigned NOT NULL,
`publish_month` tinyint(2) NOT NULL,
`chapter` varchar(4) NOT NULL DEFAULT '',
PRIMARY KEY (`id`)
) ENGINE = InnoDB
DEFAULT CHARSET = utf8mb4;
62 changes: 62 additions & 0 deletions scripts/ddl/data.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
--
-- PostgreSQL database dump
--

-- Dumped from database version 9.6.10
-- Dumped by pg_dump version 9.6.10

SET statement_timeout = 0;
SET lock_timeout = 0;
SET idle_in_transaction_session_timeout = 0;
SET client_encoding = 'UTF8';
SET standard_conforming_strings = on;
SELECT pg_catalog.set_config('search_path', '', false);
SET check_function_bodies = false;
SET client_min_messages = warning;
SET row_security = off;

--
-- Name: plpgsql; Type: EXTENSION; Schema: -; Owner:
--

CREATE EXTENSION IF NOT EXISTS plpgsql WITH SCHEMA pg_catalog;


--
-- Name: EXTENSION plpgsql; Type: COMMENT; Schema: -; Owner:
--

COMMENT ON EXTENSION plpgsql IS 'PL/pgSQL procedural language';


SET default_tablespace = '';

SET default_with_oids = false;

--
-- Name: _article_likes; Type: TABLE; Schema: public; Owner: rebasedata
--

CREATE TABLE public._article_likes (
id character varying(1) DEFAULT NULL::character varying,
article_id character varying(1) DEFAULT NULL::character varying,
client_id character varying(1) DEFAULT NULL::character varying,
created_at character varying(1) DEFAULT NULL::character varying,
is_like character varying(1) DEFAULT NULL::character varying
);


ALTER TABLE public._article_likes OWNER TO rebasedata;

--
-- Data for Name: _article_likes; Type: TABLE DATA; Schema: public; Owner: rebasedata
--

COPY public._article_likes (id, article_id, client_id, created_at, is_like) FROM stdin;
\.


--
-- PostgreSQL database dump complete
--

Loading

0 comments on commit c42c267

Please sign in to comment.