Skip to content

Commit

Permalink
feat: 增加了一部分 dto 和 schemes
Browse files Browse the repository at this point in the history
  • Loading branch information
Mereithhh committed May 20, 2022
1 parent cbc1c2d commit 1edaf0f
Show file tree
Hide file tree
Showing 9 changed files with 149 additions and 0 deletions.
6 changes: 6 additions & 0 deletions lerna.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"packages": [
"packages/*"
],
"version": "0.0.0"
}
7 changes: 7 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"name": "root",
"private": true,
"devDependencies": {
"lerna": "^4.0.0"
}
}
6 changes: 6 additions & 0 deletions packages/server/src/dto/link.dto.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
export class LinkItem {
createdAt: Date;
updatedAt: Date;
url: string;
type: string;
}
6 changes: 6 additions & 0 deletions packages/server/src/dto/reward.dto.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
export class RewardItem {
createdAt: Date;
updatedAt: Date;
value: string;
name: string;
}
13 changes: 13 additions & 0 deletions packages/server/src/dto/site.dto.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
export class SiteInfo {
author: string;
authorLogo: string;
siteLogo: string;
favicon: string;
siteName: string;
siteDesc: string;
beianNumber: string;
beianUrl: string;
payAliPay: string;
payWechat: string;
since: Date;
}
7 changes: 7 additions & 0 deletions packages/server/src/dto/social.dto.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
export type SocialType = 'bilibili' | 'email' | 'github' | 'wechat';
export class SocialItem {
createdAt: Date;
updatedAt: Date;
value: string;
type: SocialType;
}
39 changes: 39 additions & 0 deletions packages/server/src/schemes/article.schema.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
import { Prop, Schema, SchemaFactory } from '@nestjs/mongoose';
import { Document } from 'mongoose';

export type ArticleDocument = Article & Document;

@Schema()
export class Article extends Document {
@Prop()
id: number;

@Prop()
title: string;

@Prop()
author: string;

@Prop()
content: string;

@Prop()
tags: string[];

@Prop()
categories: string[];

@Prop()
hiden: boolean;

@Prop()
private: boolean;

@Prop()
password: string;

@Prop()
desc: string;
}

export const ArticleSchema = SchemaFactory.createForClass(Article);
30 changes: 30 additions & 0 deletions packages/server/src/schemes/draft.schema.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
import { Prop, Schema, SchemaFactory } from '@nestjs/mongoose';
import { Document } from 'mongoose';

export type DraftDocument = Draft & Document;

@Schema()
export class Draft extends Document {
@Prop()
id: number;

@Prop()
title: string;

@Prop()
author: string;

@Prop()
content: string;

@Prop()
tags: string[];

@Prop()
categories: string[];

@Prop()
desc: string;
}

export const DraftSchema = SchemaFactory.createForClass(Draft);
35 changes: 35 additions & 0 deletions packages/server/src/schemes/meta.schema.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
import { Prop, Schema, SchemaFactory } from '@nestjs/mongoose';
import { Document } from 'mongoose';
import { LinkItem } from 'src/dto/link.dto';
import { RewardItem } from 'src/dto/reward.dto';
import { SiteInfo } from 'src/dto/site.dto';
import { SocialItem } from 'src/dto/social.dto';

export type MetaDocument = Meta & Document;

@Schema()
export class Meta extends Document {
@Prop()
id: number;

@Prop()
links: LinkItem[];

@Prop()
socials: SocialItem[];

@Prop()
rewards: RewardItem[];

@Prop()
about: {
createdAt: Date;
updatedAt: Date;
content: string;
};

@Prop()
siteInfo: SiteInfo;
}

export const MetaSchema = SchemaFactory.createForClass(Meta);

0 comments on commit 1edaf0f

Please sign in to comment.