Using javascript algorithm to create list of db entries

Hey everyone,

I have had a friend put together a JS script that will create a schedule of matches (team 1 vs team 2, etc, etc) based upon a set of rules. The output currently looks like this.

GW1: [('A2', 'D2'), ('C2', 'D1'), ('B2', 'C1'), ('A1', 'B1')]
GW2: [('B1', 'A2'), ('C1', 'A1'), ('D1', 'B2'), ('D2', 'C2')]
GW3: [('A2', 'C2'), ('B2', 'D2'), ('A1', 'D1'), ('B1', 'C1')]
GW4: [('C1', 'A2'), ('D1', 'B1'), ('D2', 'A1'), ('C2', 'B2')]
GW5: [('A2', 'B2'), ('A1', 'C2'), ('B1', 'D2'), ('C1', 'D1')]
GW6: [('D1', 'A2'), ('D2', 'C1'), ('C2', 'B1'), ('B2', 'A1')]

GW stands for Gameweek.
First letter include user. In here 4 users A,B,C,D.
Second letter is the teams. Here A user has 2 teams A1, A2 and like wise.

My goal is to use this JS to create a list of db entries. Each database entry will be each match up.

Without going into too much details about how my db is structured etc, etc, i would like to know if this is even possible in Bubble. Does anyone have any experience in using javascript to generate db entries?

Any help will be much appreciated