Skip to content

重复的id column #518

@Travisliang001

Description

@Travisliang001

感觉这里的重复_id 不太合理因为BaseEntity 已经有了,请问有考虑把这里clean up一下吗?

`
clientEncrypt.entity.ts
import { Entity, Column, Index, ObjectIdColumn } from 'typeorm';
import { ObjectId } from 'mongodb';
import { ENCRYPT_TYPE } from '../enums/encrypt';
import { BaseEntity } from './base.entity';

@entity({ name: 'clientEncrypt' })
export class ClientEncrypt extends BaseEntity {
@Index({
expireAfterSeconds: 3600,
})
@ObjectIdColumn()
_id: ObjectId;

@column('jsonb')
data: {
secretKey?: string; // aes加密的密钥
publicKey?: string; // rsa加密的公钥
privateKey?: string; // rsa加密的私钥
};

@column()
type: ENCRYPT_TYPE;
}

base.entity.ts

import { ObjectIdColumn, CreateDateColumn, UpdateDateColumn } from 'typeorm';
import { ObjectId } from 'mongodb';

export class BaseEntity {
@ObjectIdColumn()
_id: ObjectId;

@CreateDateColumn({ type: 'timestamp', precision: 3 })
createdAt: Date;

@UpdateDateColumn({ type: 'timestamp', precision: 3 })
updatedAt: Date;
}

`

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions