removed .env. SMPT Supertokens.
This commit is contained in:
@@ -6,6 +6,7 @@ import {
|
||||
import supertokens from 'supertokens-node';
|
||||
import ThirdPartyEmailPassword from 'supertokens-node/recipe/thirdpartyemailpassword';
|
||||
import EmailPassword from 'supertokens-node/recipe/emailpassword';
|
||||
import { STMPService } from 'supertokens-node/recipe/thirdpartyemailpassword/emaildelivery';
|
||||
|
||||
import Session from 'supertokens-node/recipe/session';
|
||||
|
||||
@@ -19,7 +20,23 @@ export class SupertokensService {
|
||||
apiKey: config.apiKey,
|
||||
},
|
||||
recipeList: [
|
||||
EmailPassword.init(),
|
||||
EmailPassword.init({
|
||||
emailDelivery: {
|
||||
service: new STMPService({
|
||||
smtpSettings: {
|
||||
host: process.env.SMTP_HOST,
|
||||
authUsername: process.env.SMTP_USERNAME,
|
||||
password: process.env.SMTP_PASSWORD,
|
||||
port: parseInt(process.env.SMTP_PORT),
|
||||
from: {
|
||||
name: process.env.SMTP_FROM_NAME,
|
||||
email: process.env.SMTP_FROM_EMAIL,
|
||||
},
|
||||
secure: process.env.SMTP_SECURE ? true : false,
|
||||
},
|
||||
}),
|
||||
},
|
||||
}),
|
||||
ThirdPartyEmailPassword.init({
|
||||
providers: [
|
||||
ThirdPartyEmailPassword.Google({
|
||||
|
||||
@@ -13,6 +13,14 @@ export class CreateUserInput {
|
||||
password: string;
|
||||
}
|
||||
|
||||
export class UpdateUserInput {
|
||||
email?: Nullable<string>;
|
||||
password?: Nullable<string>;
|
||||
time_joined?: Nullable<number>;
|
||||
createdAt?: Nullable<DateTime>;
|
||||
updatedAt?: Nullable<DateTime>;
|
||||
}
|
||||
|
||||
export class User {
|
||||
id: string;
|
||||
email: string;
|
||||
@@ -31,6 +39,8 @@ export abstract class IQuery {
|
||||
export abstract class IMutation {
|
||||
abstract createUser(createUserInput: CreateUserInput): User | Promise<User>;
|
||||
|
||||
abstract updateUser(id: string, updateUserInput: UpdateUserInput): Nullable<User> | Promise<Nullable<User>>;
|
||||
|
||||
abstract removeUser(id: string): Nullable<User> | Promise<Nullable<User>>;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
scalar DateTime
|
||||
|
||||
type User {
|
||||
id: String!
|
||||
id: ID!
|
||||
email: String!
|
||||
password: String
|
||||
time_joined: Int,
|
||||
time_joined: Int
|
||||
createdAt: DateTime
|
||||
updatedAt: DateTime
|
||||
}
|
||||
@@ -14,17 +14,21 @@ input CreateUserInput {
|
||||
password: String!
|
||||
}
|
||||
|
||||
# input UpdateUserInput {
|
||||
# id: String!
|
||||
# }
|
||||
input UpdateUserInput {
|
||||
email: String
|
||||
password: String
|
||||
time_joined: Int
|
||||
createdAt: DateTime
|
||||
updatedAt: DateTime
|
||||
}
|
||||
|
||||
type Query {
|
||||
users: [User]!
|
||||
user(id: String!): User
|
||||
user(id: ID!): User
|
||||
}
|
||||
|
||||
type Mutation {
|
||||
createUser(createUserInput: CreateUserInput!): User!
|
||||
# updateUser(updateUserInput: UpdateUserInput!): User!
|
||||
removeUser(id: String!): User
|
||||
updateUser(id: ID!, updateUserInput: UpdateUserInput!): User
|
||||
removeUser(id: ID!): User
|
||||
}
|
||||
|
||||
@@ -18,17 +18,12 @@ export class UsersService {
|
||||
return this.prismaService.user.create({ data: createUserInput });
|
||||
}
|
||||
|
||||
// findAll() {
|
||||
// return `This action returns all users`;
|
||||
// }
|
||||
|
||||
// findOne(id: string) {
|
||||
// return `This action returns a #${id} user`;
|
||||
// }
|
||||
|
||||
// update(id: string, updateUserInput: UpdateUserInput) {
|
||||
// return `This action updates a #${id} user`;
|
||||
// }
|
||||
update(id: string, userUpdateInput: Prisma.UserUpdateInput) {
|
||||
return this.prismaService.user.update({
|
||||
where: { id },
|
||||
data: userUpdateInput,
|
||||
});
|
||||
}
|
||||
|
||||
// remove(id: string) {
|
||||
// return `This action removes a #${id} user`;
|
||||
|
||||
Reference in New Issue
Block a user