feat: Initial payment implementation

This commit is contained in:
Faruk AYDIN
2023-03-05 17:12:46 +01:00
parent 63f8fc266d
commit 5e18ef5830
10 changed files with 268 additions and 4 deletions

View File

@@ -1,15 +1,17 @@
import User from '../../models/user';
import Billing from '../../helpers/billing/index.ee';
import appConfig from '../../config/app';
type Params = {
input: {
fullName: string;
email: string;
password: string;
fullName: string;
};
};
const createUser = async (_parent: unknown, params: Params) => {
const { email, password, fullName } = params.input;
const { fullName, email, password } = params.input;
const existingUser = await User.query().findOne({ email });
@@ -18,12 +20,16 @@ const createUser = async (_parent: unknown, params: Params) => {
}
const user = await User.query().insert({
fullName,
email,
password,
fullName,
role: 'user',
});
if (appConfig.isCloud) {
Billing.createSubscription(user);
}
return user;
};