mirror of
https://github.com/gristlabs/grist-core.git
synced 2026-03-02 04:09:24 +00:00
(core) Adding new column in users table "ref" with unique identifier.
Summary: There is a new column in users table called ref (user reference). It holds user's unique reference number that can be used for features that require some kind of ownership logic (like comments). Test Plan: Updated tests Reviewers: georgegevoian, paulfitz Reviewed By: georgegevoian, paulfitz Differential Revision: https://phab.getgrist.com/D3641
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
import {UserOptions} from 'app/common/UserAPI';
|
||||
import {nativeValues} from 'app/gen-server/lib/values';
|
||||
import {BaseEntity, Column, Entity, JoinTable, ManyToMany, OneToMany, OneToOne,
|
||||
import {makeId} from 'app/server/lib/idUtils';
|
||||
import {BaseEntity, BeforeInsert, Column, Entity, JoinTable, ManyToMany, OneToMany, OneToOne,
|
||||
PrimaryGeneratedColumn} from "typeorm";
|
||||
|
||||
import {Group} from "./Group";
|
||||
@@ -50,6 +51,19 @@ export class User extends BaseEntity {
|
||||
@Column({name: 'connect_id', type: String, nullable: true})
|
||||
public connectId: string | null;
|
||||
|
||||
/**
|
||||
* Unique reference for this user. Primarily used as an ownership key in a cell metadata (comments).
|
||||
*/
|
||||
@Column({name: 'ref', type: String, nullable: false})
|
||||
public ref: string;
|
||||
|
||||
@BeforeInsert()
|
||||
public async beforeInsert() {
|
||||
if (!this.ref) {
|
||||
this.ref = makeId();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get user's email. Returns undefined if logins has not been joined, or no login
|
||||
* is available
|
||||
|
||||
Reference in New Issue
Block a user