generated from tailored/router-template
temp
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
import { QueryRouterServer } from '@kevisual/router';
|
||||
import { XhsServices } from '@/services/xhs-services.ts';
|
||||
import { QueryRouterServer } from '@kevisual/router/browser';
|
||||
import { XhsServices } from '@kevisual/xhs/services/xhs-services.ts';
|
||||
|
||||
export const app = new QueryRouterServer();
|
||||
export const xhsServices = new XhsServices();
|
||||
|
||||
@@ -49,7 +49,7 @@ export const getSign = async (signInfo: SignInfo, options?: SignOptions): Promis
|
||||
web_session: web_session,
|
||||
}),
|
||||
}).then((res) => res.json());
|
||||
return signs;
|
||||
return signs as SignResponse;
|
||||
} catch (error) {
|
||||
return null;
|
||||
}
|
||||
@@ -161,7 +161,7 @@ export class XhsClient extends XhsClientBase {
|
||||
const url = '/api/sns/web/v1/you/mentions';
|
||||
const response = await this.get(
|
||||
url,
|
||||
{ num: 20, cursor: '' },
|
||||
{ num: num, cursor: '' },
|
||||
{
|
||||
sign: this.sign.bind(this),
|
||||
needSign: true,
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { app, xhsServices } from '@/app.ts';
|
||||
import { Parse } from '@/libs/parse.ts';
|
||||
import { app, xhsServices } from '@kevisual/xhs/app.ts';
|
||||
import { Parse } from '@kevisual/xhs/libs/parse.ts';
|
||||
app
|
||||
.route({
|
||||
path: 'fans',
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { app, xhsServices } from '@/app.ts';
|
||||
import { app, xhsServices } from '@kevisual/xhs/app.ts';
|
||||
|
||||
app
|
||||
.route({
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { app, xhsServices } from '@/app.ts';
|
||||
import { Mention } from '@/libs/xhs-type/mention.ts';
|
||||
import { Parse } from '@/libs/parse.ts';
|
||||
import { app, xhsServices } from '@kevisual/xhs/app.ts';
|
||||
import { Mention } from '@kevisual/xhs/libs/xhs-type/mention.ts';
|
||||
import { Parse } from '@kevisual/xhs/libs/parse.ts';
|
||||
|
||||
app
|
||||
.route({
|
||||
@@ -20,7 +20,7 @@ app
|
||||
path: 'mention',
|
||||
key: 'getMention',
|
||||
payload: {
|
||||
num: 2,
|
||||
num: unread_count,
|
||||
},
|
||||
});
|
||||
if (mentionRes.code === 200) {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { InitOptions, Model, Sequelize, SyncOptions } from 'sequelize';
|
||||
import { DBModel, Sequelize, SyncOptions } from '@kevisual/db';
|
||||
import { DataTypes } from 'sequelize';
|
||||
export class Comment extends Model {
|
||||
export class Comment extends DBModel {
|
||||
declare id: number;
|
||||
declare content: string;
|
||||
declare note_id: string;
|
||||
@@ -8,7 +8,7 @@ export class Comment extends Model {
|
||||
declare comment_id: string;
|
||||
declare created_at: Date;
|
||||
declare updated_at: Date;
|
||||
static async initModel(sequelize: Sequelize, initOptions?: InitOptions, opts?: SyncOptions) {
|
||||
static async initModel(sequelize: Sequelize, opts?: SyncOptions) {
|
||||
Comment.init(
|
||||
{
|
||||
id: {
|
||||
@@ -36,7 +36,6 @@ export class Comment extends Model {
|
||||
{
|
||||
sequelize, // passing the `sequelize` instance is required
|
||||
modelName: 'Comment', // we need to choose the model name
|
||||
...initOptions,
|
||||
},
|
||||
);
|
||||
await Comment.sync(opts || {});
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { XhsClient } from '@/libs/xhs.ts';
|
||||
import { XhsClient } from '@kevisual/xhs/libs/xhs.ts';
|
||||
import { Sequelize } from 'sequelize';
|
||||
import { createSequelize } from '@/services/xhs-db/db.ts';
|
||||
import { createSequelize } from '@kevisual/xhs/services/xhs-db/db.ts';
|
||||
import path from 'node:path';
|
||||
import fs from 'node:fs';
|
||||
|
||||
@@ -22,6 +22,10 @@ type XhsClientMap = {
|
||||
type XhsServicesOptions = {
|
||||
root?: string;
|
||||
};
|
||||
/**
|
||||
* @description XhsServices is a singleton class that manages the XhsClient instances.
|
||||
* It is used to create and manage the XhsClient instances.
|
||||
*/
|
||||
export class XhsServices {
|
||||
map: Map<string, XhsClientMap> = new Map();
|
||||
root: string = 'root';
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { Comment } from '@/services/xhs-db/comment.ts';
|
||||
import { Comment } from '@kevisual/xhs/services/xhs-db/comment.ts';
|
||||
|
||||
import { Sequelize, Model, DataTypes, InferAttributes, InferCreationAttributes } from 'sequelize';
|
||||
import path from 'path';
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { app } from '@/index.ts';
|
||||
import { app } from '@kevisual/xhs/index.ts';
|
||||
|
||||
app.parse({
|
||||
path: 'mention',
|
||||
|
||||
Reference in New Issue
Block a user