Skip to content

Commit

Permalink
add stream mutation changes (#434)
Browse files Browse the repository at this point in the history
  • Loading branch information
soson authored May 22, 2024
1 parent 9033481 commit 4d88523
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 2 deletions.
1 change: 1 addition & 0 deletions src/schema/api.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ type AddSnapshotPayload {
input AddStreamInput {
deviceName: String!
streamName: String!
streamParameters: String
}

type AddStreamPayload {
Expand Down
1 change: 1 addition & 0 deletions src/schema/nexus-typegen.ts
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ export interface NexusGenInputs {
// input type
deviceName: string; // String!
streamName: string; // String!
streamParameters?: string | null; // String
};
AddZoneInput: {
// input type
Expand Down
6 changes: 4 additions & 2 deletions src/schema/stream.ts
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,7 @@ export const AddStreamInput = inputObjectType({
definition: (t) => {
t.nonNull.string('streamName');
t.nonNull.string('deviceName');
t.string('streamParameters');
},
});

Expand All @@ -139,6 +140,7 @@ export const AddStreamMutation = extendType({
data: {
deviceName: input.deviceName,
streamName: input.streamName,
streamParameters: input.streamParameters != null ? JSON.parse(input.streamParameters) : undefined,
tenantId,
},
});
Expand Down Expand Up @@ -180,13 +182,13 @@ export const ActivateStreamMutation = extendType({
const { streamName, deviceName, streamParameters, device } = stream;
const uniconfigStreamName = getUniconfigStreamName(streamName, deviceName);
// TODO: create column stream params
const installDeviceParams = prepareInstallParameters(
const installStreamParams = prepareInstallParameters(
uniconfigStreamName,
getMountParamsForStream(device.mountParameters, streamParameters),
);

const uniconfigURL = await getUniconfigURL(prisma, device.uniconfigZoneId);
await installDeviceCache({ uniconfigURL, deviceName: uniconfigStreamName, params: installDeviceParams });
await installDeviceCache({ uniconfigURL, deviceName: uniconfigStreamName, params: installStreamParams });

return { stream };
},
Expand Down

0 comments on commit 4d88523

Please sign in to comment.