Skip to content

Commit

Permalink
update some docs to link to correct file
Browse files Browse the repository at this point in the history
location was changed at #513 but this wasn't updated
  • Loading branch information
lolopinto committed May 21, 2022
1 parent eceb150 commit 4e26d4b
Show file tree
Hide file tree
Showing 16 changed files with 218 additions and 106 deletions.
30 changes: 17 additions & 13 deletions docs/docs/actions/action-only-fields.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ In the [address example](/docs/actions/triggers#changeset), with the Event schem
export default class Event extends BaseEntSchema implements Schema {

actions: Action[] = [

{
operation: ActionOperation.Create,
actionOnlyFields: [
Expand All @@ -23,8 +24,10 @@ export default class Event extends BaseEntSchema implements Schema {
},
],
},
];

];
}

```

```ts title="src/schema/address.ts"
Expand Down Expand Up @@ -56,24 +59,25 @@ we end up with the following changes:

```ts title="src/ent/event/actions/generated/create_event_action_base.ts"
interface customAddressInput {
street: string;
city: string;
state: string;
zipCode: string;
apartment?: string | null;
street: string;
city: string;
state: string;
zipCode: string;
apartment?: string | null;
}

export interface EventCreateInput {
name: string;
creatorID: ID | Builder<User>;
startTime: Date;
endTime?: Date | null;
location: string;
address?: customAddressInput | null;
name: string;
creatorID: ID | Builder<User>;
startTime: Date;
endTime?: Date | null;
location: string;
address?: customAddressInput | null;
}

```

```graphql title="src/graphql/schema.gql"
```graphql title="src/graphql/generated/schema.gql"
input EventCreateInput {
name: String!
creatorID: ID!
Expand Down
14 changes: 11 additions & 3 deletions docs/docs/actions/add-edge-action.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,28 +12,35 @@ First, the base class:

```ts title="src/ent/event/actions/generated/event_add_host_action_base.ts"
export class EventAddHostActionBase implements Action<Event> {
public readonly builder: EventBuilder;
public readonly viewer: Viewer;
public readonly builder: EventBuilder;
public readonly viewer: Viewer;

constructor(viewer: Viewer, event: Event) {

this.viewer = viewer;
this.builder = new EventBuilder(
this.viewer,
WriteOperation.Edit,
this,
event,
);

}

getPrivacyPolicy(): PrivacyPolicy {

return AllowIfViewerHasIdentityPrivacyPolicy;

}

addHost(id: ID) {

//...

}
// ...
}

```

and then the subclass:
Expand Down Expand Up @@ -74,7 +81,7 @@ The subclass will be generated **once** and any customizations can be applied th

The following GraphQL schema is generated which uses the above API.

``` title="src/graphql/schema.gql"
``` title="src/graphql/generated/schema.gql"
type Mutation {
eventAddHost(input: EventAddHostInput!): EventAddHostPayload!
}
Expand All @@ -97,6 +104,7 @@ type Event implements Node {
eventLocation: String!
///....
}
```

and called as follows:
Expand Down
17 changes: 11 additions & 6 deletions docs/docs/actions/create-action.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,14 @@ Based on the [schema](/docs/actions/action#schema) with the following extra conf
export default class Event extends BaseEntSchema implements Schema {

actions: Action[] = [

{
operation: ActionOperation.Create,
},
];

];
}

```

leads to 2 classes.
Expand Down Expand Up @@ -56,14 +59,15 @@ and then the subclass:

```ts title="src/ent/event/actions/create_event_action.ts"
import {
CreateEventActionBase,
EventCreateInput,
} from "src/ent/event/actions/generated/create_event_action_base";
CreateEventActionBase,
EventCreateInput,
} from "src/ent/event/actions/generated/create_event_action_base";

export { EventCreateInput };
export { EventCreateInput };

export default class CreateEventAction extends CreateEventActionBase {
}

```

The base class `CreateEventActionBase` is where all shared functionality is and will be regenerated as the action configuration changes. It has the default privacy policy plus a bunch of other methods shown below.
Expand Down Expand Up @@ -102,7 +106,7 @@ The subclass will be generated **once** and any customizations can be applied th

The following GraphQL schema is generated which uses the above API.

``` title="src/graphql/schema.gql"
``` title="src/graphql/generated/schema.gql"
type Mutation {
eventCreate(input: EventCreateInput!): EventCreatePayload!
}
Expand All @@ -128,6 +132,7 @@ type Event implements Node {
eventLocation: String!
///....
}
```

and called as follows:
Expand Down
11 changes: 8 additions & 3 deletions docs/docs/actions/delete-action.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,14 @@ Based on the [schema](/docs/actions/action#schema) with the following extra conf
export default class Event extends BaseEntSchema implements Schema {

actions: Action[] = [

{
operation: ActionOperation.Delete,
},
];

];
}

```

leads to 2 classes.
Expand Down Expand Up @@ -49,9 +52,10 @@ and then the subclass:

```ts title="src/ent/event/actions/delete_event_action.ts"
import {
import { DeleteEventActionBase } from "src/ent/event/actions/generated/delete_event_action_base";
import { DeleteEventActionBase } from "src/ent/event/actions/generated/delete_event_action_base";

export default class DeleteEventAction extends DeleteEventActionBase {}

```

The base class `DeleteEventActionBase` is where all shared functionality is and will be regenerated as the action configuration changes. It has the default privacy policy plus a bunch of other methods shown below.
Expand All @@ -74,7 +78,7 @@ The subclass will be generated **once** and any customizations can be applied th

The following GraphQL schema is generated which uses the above API.

``` title="src/graphql/schema.gql"
``` title="src/graphql/generated/schema.gql"
type Mutation {
eventDelete(input: EventDeleteInput!): EventDeletePayload!
}
Expand All @@ -96,6 +100,7 @@ type Event implements Node {
eventLocation: String!
///....
}
```

and called as follows:
Expand Down
24 changes: 15 additions & 9 deletions docs/docs/actions/edge-group-action.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,22 +12,23 @@ First, the base class:

```ts title="src/ent/event/actions/generated/edit_event_rsvp_status_action_base.ts"
export enum EventRsvpStatusInput {
Attending = "attending",
Declined = "declined",
Maybe = "maybe",
Attending = "attending",
Declined = "declined",
Maybe = "maybe",
}

export interface EditEventRsvpStatusInput {
rsvpStatus: EventRsvpStatusInput;
userID: ID;
rsvpStatus: EventRsvpStatusInput;
userID: ID;
}

export class EditEventRsvpStatusActionBase implements Action<Event> {
public readonly builder: EventBuilder;
public readonly viewer: Viewer;
protected input: EditEventRsvpStatusInput;
public readonly builder: EventBuilder;
public readonly viewer: Viewer;
protected input: EditEventRsvpStatusInput;

constructor(viewer: Viewer, event: Event, input: EditEventRsvpStatusInput) {

this.viewer = viewer;
this.input = input;
this.builder = new EventBuilder(
Expand All @@ -36,12 +37,16 @@ export class EditEventRsvpStatusActionBase implements Action<Event> {
this,
event,
);

}

getPrivacyPolicy(): PrivacyPolicy {

return AllowIfViewerHasIdentityPrivacyPolicy;

}
}

```

and then the subclass:
Expand Down Expand Up @@ -86,7 +91,7 @@ The subclass will be generated **once** and any customizations can be applied th

The following GraphQL schema is generated which uses the above API.

``` title="src/graphql/schema.gql"
``` title="src/graphql/generated/schema.gql"
type Mutation {
eventRsvpStatusEdit(input: EventRsvpStatusEditInput!): EventRsvpStatusEditPayload!
Expand Down Expand Up @@ -117,6 +122,7 @@ type Event implements Node {
eventLocation: String!
///....
}
```

and called as follows:
Expand Down
19 changes: 12 additions & 7 deletions docs/docs/actions/edit-action.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,14 @@ Based on the [schema](/docs/actions/action#schema) with the following extra conf
export default class Event extends BaseEntSchema implements Schema {

actions: Action[] = [

{
operation: ActionOperation.Edit,
},
];

];
}

```

leads to 2 classes.
Expand Down Expand Up @@ -56,14 +59,15 @@ and then the subclass:

```ts title="src/ent/event/actions/edit_event_action.ts"
import {
EditEventActionBase,
EventEditInput,
} from "src/ent/event/actions/generated/edit_event_action_base";
EditEventActionBase,
EventEditInput,
} from "src/ent/event/actions/generated/edit_event_action_base";

export { EventEditInput };
export { EventEditInput };

export default class EditEventAction extends EditEventActionBase {
}

```

The base class `EditEventActionBase` is where all shared functionality is and will be regenerated as the action configuration changes. It has the default privacy policy plus a bunch of other methods shown below.
Expand Down Expand Up @@ -99,7 +103,7 @@ The subclass will be generated **once** and any customizations can be applied th

The following GraphQL schema is generated which uses the above API.

``` title="src/graphql/schema.gql"
``` title="src/graphql/generated/schema.gql"
type Mutation {
eventEdit(input: EventEditInput!): EventEditPayload!
}
Expand All @@ -126,6 +130,7 @@ type Event implements Node {
eventLocation: String!
///....
}
```

and called as follows:
Expand All @@ -150,6 +155,6 @@ mutation eventEditMutation($input: EventEditInput!) {

## Input

When editing an object, every field is optional and isn't required to be passed in. Only fields passed in will be changed. To set a nullable field to `null`, explicitly set it to null either via the API in TypeScript or GraphQL.
When editing an object, every field is optional and isn't required to be passed in. Only fields passed in will be changed. To set a nullable field to `null` , explicitly set it to null either via the API in TypeScript or GraphQL.

To explicitly make a field required in an action, use [requiredField](/docs/ent-schema/actions#requiredfield) when configuring it.
14 changes: 11 additions & 3 deletions docs/docs/actions/remove-edge-action.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,28 +12,35 @@ First, the base class:

```ts title="src/ent/event/actions/generated/event_remove_host_action_base.ts"
export class EventRemoveHostActionBase implements Action<Event> {
public readonly builder: EventBuilder;
public readonly viewer: Viewer;
public readonly builder: EventBuilder;
public readonly viewer: Viewer;

constructor(viewer: Viewer, event: Event) {

this.viewer = viewer;
this.builder = new EventBuilder(
this.viewer,
WriteOperation.Edit,
this,
event,
);

}

getPrivacyPolicy(): PrivacyPolicy {

return AllowIfViewerHasIdentityPrivacyPolicy;

}

removeHost(id: ID) {

//...

}
// ...
}

```

and then the subclass:
Expand Down Expand Up @@ -76,7 +83,7 @@ The subclass will be generated **once** and any customizations can be applied th

The following GraphQL schema is generated which uses the above API.

``` title="src/graphql/schema.gql"
``` title="src/graphql/generated/schema.gql"
type Mutation {
eventRemoveHost(input: EventRemoveHostInput!): EventRemoveHostPayload!
}
Expand All @@ -99,6 +106,7 @@ type Event implements Node {
eventLocation: String!
///....
}
```

and called as follows:
Expand Down
Loading

0 comments on commit 4e26d4b

Please sign in to comment.