-
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
Showing
13 changed files
with
89 additions
and
108 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
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,19 @@ | ||
import { Queue } from '#src/providers/facades/queue' | ||
|
||
export class BaseJob { | ||
public static connection() { | ||
return 'default' | ||
} | ||
|
||
public static queue() { | ||
const connection = this.connection() | ||
|
||
return Config.get(`queue.connections.${connection}.queue`) | ||
} | ||
|
||
public queue() { | ||
const Job = this.constructor as typeof BaseJob | ||
|
||
return Queue.connection(Job.connection()).queue(Job.queue()) | ||
} | ||
} |
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,31 @@ | ||
import { Mail } from '@athenna/mail' | ||
import type { User } from '#src/models/user' | ||
import { BaseJob } from '#src/jobs/base.job' | ||
|
||
type Item = { | ||
view: string | ||
subject: string | ||
user: User | ||
email: string | ||
password: string | ||
token: string | ||
} | ||
|
||
export class MailJob extends BaseJob { | ||
public static queue() { | ||
return 'mail' | ||
} | ||
|
||
public async handle(item: Item) { | ||
await Mail.from('noreply@athenna.io') | ||
.to(item.user.email) | ||
.subject(item.subject) | ||
.view(item.view, { | ||
user: item.user, | ||
email: item.email, | ||
password: item.password, | ||
token: item.token | ||
}) | ||
.send() | ||
} | ||
} |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
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
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
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