72 lines
1.5 KiB
TypeScript
72 lines
1.5 KiB
TypeScript
import { ObjectType, Field, ID, ArgsType, InputType } from 'type-graphql';
|
|
|
|
import { BaseGraphModel } from '@seed/graphql/BaseGraphModel';
|
|
import { Permission } from '@seed/interfaces/permission';
|
|
|
|
import { GetManyArgs } from '@seed/graphql/Request';
|
|
|
|
import { SettingsType } from '@seed/interfaces/components';
|
|
import { AccountTypeEnum } from '@src/accounts/account.components';
|
|
|
|
const permissions: Permission = {
|
|
c: [AccountTypeEnum.admin],
|
|
r: [AccountTypeEnum.admin],
|
|
w: [AccountTypeEnum.admin],
|
|
d: [AccountTypeEnum.admin],
|
|
};
|
|
|
|
@ObjectType()
|
|
export default class ProjectSettingModel extends BaseGraphModel {
|
|
public constructor() {
|
|
super({
|
|
// ...init,
|
|
collectionName: 'settings',
|
|
permissions: permissions,
|
|
});
|
|
}
|
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
@Field(() => ID)
|
|
readonly _id: string;
|
|
|
|
@Field(() => SettingsType)
|
|
type = SettingsType.env;
|
|
|
|
@Field()
|
|
key: string;
|
|
|
|
@Field()
|
|
value: string;
|
|
|
|
searchOptions(): string[] {
|
|
return ['key', 'type'];
|
|
}
|
|
filterOptions(): string[] {
|
|
return ['key', 'type'];
|
|
}
|
|
|
|
onCreate(): void {
|
|
return;
|
|
}
|
|
}
|
|
|
|
@InputType()
|
|
export class NewProjectSettingsInput {
|
|
@Field()
|
|
key: string;
|
|
|
|
@Field()
|
|
value: string;
|
|
}
|
|
|
|
@InputType()
|
|
export class EditProjectSettingsInput {
|
|
@Field({ nullable: true })
|
|
value: string;
|
|
}
|
|
|
|
@ArgsType()
|
|
export class ProjectSettingsArgs extends GetManyArgs {
|
|
@Field(() => SettingsType)
|
|
type = SettingsType.env;
|
|
}
|