✅add : correction ajout de gain et api test code
This commit is contained in:
1 parent
04423aa6c7
commit
fec63499c6
16 files changed
+339
-83
No files matched your search
@@ -2,11 +2,12 @@
|
||||
import prisma from '../../lib/prisma'
|
||||
import { Chance } from 'chance'
|
||||
import { Cadeaux } from '../../enum/cadeaux.enum';
|
||||
import cryptoRandomString from 'crypto-random-string';
|
||||
let chance = new Chance();
|
||||
|
||||
export const generateGains = async () => {
|
||||
//génération d'un code cadeau
|
||||
const randomNoGain = (Math.random() + 1).toString(36).substring(7).toUpperCase()
|
||||
const randomNoGain = cryptoRandomString({ length: 10, type: 'distinguishable' });
|
||||
|
||||
//création d'un gain
|
||||
const gainCreated = await prisma.gain.create({
|
||||
@@ -46,3 +47,4 @@ export const generateGains = async () => {
|
||||
console.log(`Created gain ! : ${gainUpdated.codeCadeau}`)
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user