Skip to content

Commit

Permalink
fix: reload schema
Browse files Browse the repository at this point in the history
  • Loading branch information
birkir committed Sep 24, 2019
1 parent 38c4244 commit f28c6a2
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 6 deletions.
10 changes: 5 additions & 5 deletions packages/prime-core/src/modules/external/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -225,10 +225,10 @@ export const createExternal = async (connection: Connection) => {
container.set('context', ctx);
return ctx;
},
// logger: {
// clientError: () => null,
// log,
// error: log,
// },
logger: {
clientError: () => null,
log,
error: log,
},
});
};
5 changes: 4 additions & 1 deletion packages/prime-core/src/modules/internal/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,14 +48,17 @@ export const createInternal = async (connection: Connection) => {
resolvers: () =>
mapValues(omitBy(schema.resolvers, noEnumsOrInheritedModels), noUndefinedTypeOf),
async context(session, currentContext) {
const accountsCtx = await accounts.context(session, currentContext);

const requestId = Math.floor(Math.random() * Number.MAX_SAFE_INTEGER);
const container = Container.of(requestId);

const ctx = {
requestId,
container,
user: ((session || {}) as any).user,
ability: createAbility(currentContext),
ability: createAbility(currentContext as any),
...accountsCtx,
};

container.set('context', ctx);
Expand Down
3 changes: 3 additions & 0 deletions packages/prime-core/src/server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,9 @@ export const createServer = async ({ port, connection }: ServerConfig) => {
external = await createExternal(connection);
externalServer.schema = external.schema;
externalServer.context = external.context;
externalServer.schemaDerivedData = externalServer.generateSchemaDerivedData(
externalServer.schema
);

if (config.sofaApi) {
app.use(
Expand Down

0 comments on commit f28c6a2

Please sign in to comment.