-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
f5fa502
commit 17b6e24
Showing
5 changed files
with
32 additions
and
20 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
import type { IRedirect, IRedirectForCreate } from '@linx/shared'; | ||
import database from './database'; | ||
|
||
const Redirects = database<IRedirect>('redirects'); | ||
|
||
export class Redirect { | ||
static async create(redirectDTO: IRedirectForCreate): Promise<IRedirect> { | ||
const [redirect] = await Redirects.insert(redirectDTO).returning('*'); | ||
|
||
return redirect; | ||
} | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,9 @@ | ||
import { Link } from './Link'; | ||
import { Redirect } from './Redirect'; | ||
import { User } from './User'; | ||
|
||
export default class Repository { | ||
static user = User; | ||
static link = Link; | ||
static redirect = Redirect; | ||
} |
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 |
---|---|---|
@@ -1,8 +1,9 @@ | ||
import type { IRedirect, IRedirectForCreate } from '@linx/shared'; | ||
import type { IRedirectForCreate } from '@linx/shared'; | ||
import Repository from '../repository'; | ||
|
||
export default class Redirect { | ||
static async create(redirect: IRedirectForCreate) { | ||
//todo: complete with the repository | ||
static async create(redirectDTO: IRedirectForCreate) { | ||
const redirect = await Repository.redirect.create(redirectDTO); | ||
return redirect; | ||
} | ||
} |