1
0
mirror of https://github.com/Unleash/unleash.git synced 2024-12-22 19:07:54 +01:00

fix: project store was wrongly typing its id field as number (#822)

This commit is contained in:
Christopher Kolstad 2021-04-30 12:51:46 +02:00 committed by GitHub
parent 2df0907e1c
commit 4c3a77bc31
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 17 additions and 8 deletions

View File

@ -7,20 +7,20 @@ const COLUMNS = ['id', 'name', 'description', 'created_at'];
const TABLE = 'projects';
export interface IProject {
id: number;
id: string;
name: string;
description: string;
createdAt: Date;
}
interface IProjectInsert {
id: number;
id: string;
name: string;
description: string;
}
interface IProjectArchived {
id: number;
id: string;
archived: boolean;
}
@ -51,7 +51,7 @@ class ProjectStore {
return rows.map(this.mapRow);
}
async get(id): Promise<IProject> {
async get(id: string): Promise<IProject> {
return this.db
.first(COLUMNS)
.from(TABLE)
@ -59,7 +59,7 @@ class ProjectStore {
.then(this.mapRow);
}
async hasProject(id): Promise<IProjectArchived> {
async hasProject(id: string): Promise<IProjectArchived> {
return this.db
.first('id')
.from(TABLE)

View File

@ -14,6 +14,8 @@ import {
PROJECT_DELETED,
PROJECT_UPDATED,
} from '../types/events';
import { IUnleashStores } from '../types/stores';
import { IUnleashConfig } from '../types/option';
const getCreatedBy = (user: User) => user.email || user.username;
@ -36,8 +38,15 @@ export default class ProjectService {
private logger: any;
constructor(
{ projectStore, eventStore, featureToggleStore },
config: any,
{
projectStore,
eventStore,
featureToggleStore,
}: Pick<
IUnleashStores,
'projectStore' | 'eventStore' | 'featureToggleStore'
>,
config: IUnleashConfig,
accessService: AccessService,
) {
this.projectStore = projectStore;
@ -51,7 +60,7 @@ export default class ProjectService {
return this.projectStore.getAll();
}
async getProject(id: number): Promise<IProject> {
async getProject(id: string): Promise<IProject> {
return this.projectStore.get(id);
}