Skip to content

Commit df07999

Browse files
authored
Merge pull request #3544 from SeedCompany/tools
2 parents ad69843 + 53acc7d commit df07999

39 files changed

+1283
-1
lines changed

dbschema/migrations/00020-m1qjcnn.edgeql

Lines changed: 48 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dbschema/resource.gel

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
11
module default {
2-
abstract type Resource extending Mixin::Audited;
2+
abstract type Resource extending Mixin::Audited {
3+
tools := .<container[is Tool::Usage];
4+
}
35
}

dbschema/tool.gel

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
module default {
2+
type Tool extending Resource, Mixin::Named {
3+
overloaded name {
4+
constraint exclusive;
5+
}
6+
7+
required aiBased: bool {
8+
default := false;
9+
};
10+
11+
usages := .<tool[is Tool::Usage];
12+
}
13+
}
14+
15+
module Tool {
16+
type Usage extending default::Resource, Mixin::Embedded {
17+
required tool: default::Tool;
18+
19+
overloaded required container: default::Resource {
20+
on target delete delete source;
21+
}
22+
constraint exclusive on ((.tool, .container));
23+
24+
startDate: cal::local_date;
25+
}
26+
}

src/app.module.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ import { ScriptureModule } from './components/scripture';
3838
import { SearchModule } from './components/search/search.module';
3939
import { StoryModule } from './components/story/story.module';
4040
import { TimeZoneModule } from './components/timezone';
41+
import { ToolModule } from './components/tools/tool.module';
4142
import { UserModule } from './components/user/user.module';
4243
import { CoreModule, LoggerModule } from './core';
4344

@@ -90,6 +91,7 @@ if (process.env.NODE_ENV !== 'production') {
9091
SystemNotificationModule,
9192
FinanceDepartmentModule,
9293
DBLUploadNotificationModule,
94+
ToolModule,
9395
],
9496
})
9597
export class AppModule {}

src/components/authorization/dto/power.enum.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ export const Power = makeEnum({
1919
'CreateSong',
2020
'CreateStory',
2121
'CreateUser',
22+
'CreateTool',
2223
{
2324
value: 'CreateBudget',
2425
deprecationReason: 'Use `Project.budget` instead',

src/components/authorization/policies/by-feature/read-util-objects.policy.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,5 +8,7 @@ import { Policy } from '../util';
88
// If anyone is able to read the post, then they can read its properties as well.
99
// These are declared via `XPostable.children(c => c.posts.read)`
1010
r.Post.specifically((p) => p.many('body', 'creator').read),
11+
12+
r.Tool.read,
1113
])
1214
export class ReadUtilObjectsPolicy {}

src/components/authorization/policies/by-role/consultant.policy.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ export const projectTransitions = () =>
2626
r.ProgressReportTeamNews,
2727
r.ProgressReportMedia,
2828
r.ProgressReportVarianceExplanation,
29+
r.ToolUsage,
2930
r.StepProgress,
3031
].map((it) => it.when(member).read),
3132

src/components/authorization/policies/by-role/field-operations-director.policy.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ import { Policy, Role } from '../util';
2121
'Field Ops Rejects Proposal',
2222
).execute,
2323
r.PeriodicReport.edit,
24+
r.ToolUsage.edit.create.delete,
2425
r.StepProgress.edit,
2526
])
2627
export class FieldOperationsDirectorPolicy {}

src/components/authorization/policies/by-role/project-manager.policy.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -163,6 +163,7 @@ export const momentumProjectsTransitions = () =>
163163
])
164164
.children((c) => c.posts.read.create),
165165
r.ProjectMember.read.when(member).edit.create.delete,
166+
r.ToolUsage.read.when(member).edit.create.delete,
166167
[r.StepProgress].flatMap((it) => [
167168
it.whenAll(member, variant('partner')).read,
168169
it.whenAll(member, variant('official')).edit,

src/components/search/dto/search-results.dto.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ import {
3232
TranslationProject,
3333
} from '../../project/dto';
3434
import { Story } from '../../story/dto';
35+
import { Tool } from '../../tools/tool/dto';
3536
import { User } from '../../user/dto';
3637

3738
// A mapping of searchable types to their results. Expand as needed.
@@ -58,6 +59,7 @@ const publicSearchable = {
5859
ProgressReport,
5960
FinancialReport,
6061
NarrativeReport,
62+
Tool,
6163
} as const;
6264

6365
// Same as above, but the keys are ignored from the SearchType enum,

0 commit comments

Comments
 (0)