Commit a9c2bb68 authored by nanahira's avatar nanahira

make to modern nicot

parent 18188772
......@@ -6,13 +6,13 @@ WORKDIR /usr/src/app
COPY ./package*.json ./
FROM base as builder
RUN npm ci && npm cache clean --force
RUN npm ci -f && npm cache clean --force
COPY . ./
RUN npm run build
FROM base
ENV NODE_ENV production
RUN npm ci && npm cache clean --force
RUN npm ci -f && npm cache clean --force
COPY --from=builder /usr/src/app/dist ./dist
COPY ./config.example.yaml ./config.yaml
......
......@@ -4,7 +4,7 @@ DB_HOST: localhost
DB_USER: nanahira
DB_PASS: password
DB_NAME: wall
INITIAL_TIME: '2021-12-01 00:00:00'
FETCHER_URL: http://wenyuanwall-fetcher:3000
CRON: '0 0 1 * * *'
# INITIAL_TIME: '2021-12-01 00:00:00'
# FETCHER_URL: http://wenyuanwall-fetcher:3000
# CRON: '0 0 1 * * *'
# http:
This source diff could not be displayed because it is too large. You can view the blob instead.
......@@ -4,9 +4,9 @@ import { BlacklistAccountService } from './blacklist-account.service';
import { RestfulFactory } from 'nicot';
const dec = new RestfulFactory(BlacklistAccount, {
fieldsToOmit: ['blacklist'],
relations: ['blacklist'],
});
class UpdateDto extends dec.updateDto {}
class FindAllDto extends dec.findAllDto {}
@Controller('blacklist')
export class BlacklistAccountController {
......@@ -19,7 +19,7 @@ export class BlacklistAccountController {
'Cache-Control',
'public, max-age=600, stale-while-revalidate=600, stale-if-error=604800',
)
findAll(@dec.findAllParam() param: UpdateDto) {
findAll(@dec.findAllParam() param: FindAllDto) {
return this.blacklistAccountService.findAll(param);
}
}
import { Injectable } from '@nestjs/common';
import { Injectable } from '@nestjs/common';
import { BlacklistAccount } from '../entities/blacklist-account.entity';
import { InjectDataSource } from '@nestjs/typeorm';
import { DataSource } from 'typeorm';
......
......@@ -9,7 +9,7 @@ import { CrudService, Inner } from 'nicot';
@Injectable()
export class BlacklistService extends CrudService(Blacklist, {
relations: [Inner('blacklistAccount')],
relations: [Inner('accounts')],
}) {
constructor(
@InjectDataSource() db: DataSource,
......
import { Entity, Index, ManyToOne, SelectQueryBuilder, Unique } from 'typeorm';
import { Entity, Index, ManyToOne, Unique } from 'typeorm';
import { Blacklist } from './blacklist.entity';
import { applyQueryProperty, IdBase, NotColumn, StringColumn } from 'nicot';
import { IdBase, NotColumn, QueryEqual, StringColumn } from 'nicot';
@Unique(['account', 'blacklist'])
@Entity()
export class BlacklistAccount extends IdBase() {
@Index()
@QueryEqual()
@StringColumn(11, {
required: true,
description: 'QQ account number.',
})
account: string;
@QueryEqual()
@StringColumn(32, {
required: true,
description: 'Blacklist ID.',
......@@ -23,12 +25,4 @@ export class BlacklistAccount extends IdBase() {
onDelete: 'CASCADE',
})
blacklist: Blacklist;
override applyQuery(
qb: SelectQueryBuilder<BlacklistAccount>,
entityName: string,
) {
super.applyQuery(qb, entityName);
applyQueryProperty(this, qb, entityName, 'account', 'blacklistId');
}
}
......@@ -11,7 +11,8 @@
"outDir": "./dist",
"baseUrl": "./",
"incremental": true,
"esModuleInterop": true
"esModuleInterop": true,
"skipLibCheck": true
},
"compileOnSave": true,
"allowJs": true
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment