Skip to content

Commit e790ee5

Browse files
committed
Move Project.type expression to schema so APs can use
1 parent 7896fb6 commit e790ee5

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

dbschema/project.esdl

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,12 @@ module default {
88
Mixin::Pinnable,
99
Mixin::Taggable
1010
{
11+
type := <Project::Type>.__type__.name[9:-7];
12+
1113
overloaded name {
1214
constraint exclusive;
1315
};
14-
16+
1517
overloaded required ownSensitivity: Sensitivity {
1618
annotation description := "The sensitivity of the project. \
1719
This is user settable for internships and calculated for translation projects";

src/components/project/project.edgedb.repository.ts

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,22 +4,20 @@ import { LazyGetter } from 'lazy-get-decorator';
44
import { ID, PublicOf, SortablePaginationInput, UnsecuredDto } from '~/common';
55
import { grabInstances } from '~/common/instance-maps';
66
import { ChangesOf } from '~/core/database/changes';
7-
import { castToEnum, e, RepoFor, ScopeOf } from '~/core/edgedb';
7+
import { e, RepoFor, ScopeOf } from '~/core/edgedb';
88
import {
99
ProjectConcretes as ConcreteTypes,
1010
CreateProject,
1111
IProject,
1212
Project,
1313
ProjectListInput,
14-
ProjectType,
1514
UpdateProject,
1615
} from './dto';
1716
import { ProjectRepository as Neo4jRepository } from './project.repository';
1817

19-
export const projectRefShape = e.shape(e.Project, (project) => ({
18+
export const projectRefShape = e.shape(e.Project, () => ({
2019
id: true,
21-
// default::TranslationProject -> Translation, etc.
22-
type: castToEnum(project.__type__.name.slice(9, -7), ProjectType),
20+
type: true,
2321
}));
2422

2523
const hydrate = e.shape(e.Project, (project) => ({

0 commit comments

Comments
 (0)