-
Notifications
You must be signed in to change notification settings - Fork 336
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(Mattermost Plugin): Configure notifications
- Loading branch information
1 parent
baf76ce
commit a33ef66
Showing
4 changed files
with
69 additions
and
10 deletions.
There are no files selected for viewing
26 changes: 26 additions & 0 deletions
26
packages/server/graphql/private/mutations/loginMattermost.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
import AuthToken from '../../../database/types/AuthToken' | ||
import getKysely from '../../../postgres/getKysely' | ||
import encodeAuthToken from '../../../utils/encodeAuthToken' | ||
import {MutationResolvers} from '../resolverTypes' | ||
|
||
const loginMattermost: MutationResolvers['loginMattermost'] = async ( | ||
_source, | ||
{email} | ||
) => { | ||
const pg = getKysely() | ||
const user = await pg | ||
.selectFrom('User') | ||
.selectAll() | ||
.where('email', '=', email) | ||
.executeTakeFirstOrThrow() | ||
const {id: userId, tms} = user | ||
const authToken = new AuthToken({sub: userId, tms}) | ||
|
||
return { | ||
userId, | ||
authToken: encodeAuthToken(authToken), | ||
isNewUser: true | ||
} | ||
} | ||
|
||
export default loginMattermost |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters