Skip to content

Commit

Permalink
chore: wip
Browse files Browse the repository at this point in the history
  • Loading branch information
glennmichael123 committed Feb 6, 2025
1 parent 23db0ea commit 8323fbd
Show file tree
Hide file tree
Showing 24 changed files with 256 additions and 256 deletions.
4 changes: 2 additions & 2 deletions storage/framework/core/orm/src/generate.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1013,13 +1013,13 @@ export async function generateModelString(
}
async first(): Promise<${modelName}Model | undefined> {
return await this.first()
return await this.applyFirst()
}
static async first(): Promise<${modelName}Model | undefined> {
const instance = new ${modelName}Model(null)
return await instance.first()
return await instance.applyFirst()
}
async firstOrFail(): Promise<${modelName}Model | undefined> {
Expand Down
2 changes: 1 addition & 1 deletion storage/framework/core/types/src/model-names.ts
Original file line number Diff line number Diff line change
@@ -1 +1 @@
export type ModelNames = 'Activity' | 'Project' | 'FailedJob' | 'SubscriberEmail' | 'Product' | 'AccessToken' | 'PaymentMethod' | 'Team' | 'Subscriber' | 'Transaction' | 'Job' | 'Subscription' | 'Deployment' | 'Error' | 'Release' | 'User' | 'Post'
export type ModelNames = 'Project' | 'SubscriberEmail' | 'AccessToken' | 'Team' | 'Activity' | 'Subscriber' | 'Deployment' | 'Release' | 'User' | 'Post' | 'FailedJob' | 'Product' | 'PaymentMethod' | 'Transaction' | 'Job' | 'Subscription' | 'Error'
2 changes: 1 addition & 1 deletion storage/framework/core/types/src/table-names.ts
Original file line number Diff line number Diff line change
@@ -1 +1 @@
export type TableNames = 'activities' | 'projects' | 'failed_jobs' | 'subscriber_emails' | 'products' | 'personal_access_tokens' | 'payment_methods' | 'team_users' | 'teams' | 'subscribers' | 'transactions' | 'jobs' | 'subscriptions' | 'deployments' | 'errors' | 'releases' | 'team_users' | 'users' | 'posts'
export type TableNames = 'projects' | 'subscriber_emails' | 'personal_access_tokens' | 'team_users' | 'teams' | 'activities' | 'subscribers' | 'deployments' | 'releases' | 'team_users' | 'users' | 'posts' | 'failed_jobs' | 'products' | 'payment_methods' | 'transactions' | 'jobs' | 'subscriptions' | 'errors'
14 changes: 7 additions & 7 deletions storage/framework/orm/routes.ts
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
import { route } from '@stacksjs/router'

route.get('activities', 'storage/framework/actions/src/ActivityIndexOrmAction.ts')

route.get('users', 'UserIndexOrmAction')

route.post('users', 'UserStoreOrmAction')

route.get('users/{id}', 'UserShowOrmAction')

/actions/src/ActivityShowOrmAction.ts')
route.get('activities/{id}', 'storage/framework/actions/src/ActivityShowOrmAction.ts')

route.post('activities', 'storage/framework/actions/src/ActivityStoreOrmAction.ts')

route.patch('activities/{id}', 'storage/framework/actions/src/ActivityUpdateOrmAction.ts')

route.delete('activities/{id}', 'storage/framework/actions/src/ActivityDestroyOrmAction.ts')

route.get('users', 'UserIndexOrmAction')

route.post('users', 'UserStoreOrmAction')

route.get('users/{id}', 'UserShowOrmAction')
4 changes: 2 additions & 2 deletions storage/framework/orm/src/models/AccessToken.ts
Original file line number Diff line number Diff line change
Expand Up @@ -244,13 +244,13 @@ export class AccessTokenModel {
}

async first(): Promise<AccessTokenModel | undefined> {
return await this.first()
return await this.applyFirst()
}

static async first(): Promise<AccessTokenModel | undefined> {
const instance = new AccessTokenModel(null)

return await instance.first()
return await instance.applyFirst()
}

async firstOrFail(): Promise<AccessTokenModel | undefined> {
Expand Down
4 changes: 2 additions & 2 deletions storage/framework/orm/src/models/Activity.ts
Original file line number Diff line number Diff line change
Expand Up @@ -259,13 +259,13 @@ export class ActivityModel {
}

async first(): Promise<ActivityModel | undefined> {
return await this.first()
return await this.applyFirst()
}

static async first(): Promise<ActivityModel | undefined> {
const instance = new ActivityModel(null)

return await instance.first()
return await instance.applyFirst()
}

async firstOrFail(): Promise<ActivityModel | undefined> {
Expand Down
4 changes: 2 additions & 2 deletions storage/framework/orm/src/models/Deployment.ts
Original file line number Diff line number Diff line change
Expand Up @@ -281,13 +281,13 @@ export class DeploymentModel {
}

async first(): Promise<DeploymentModel | undefined> {
return await this.first()
return await this.applyFirst()
}

static async first(): Promise<DeploymentModel | undefined> {
const instance = new DeploymentModel(null)

return await instance.first()
return await instance.applyFirst()
}

async firstOrFail(): Promise<DeploymentModel | undefined> {
Expand Down
4 changes: 2 additions & 2 deletions storage/framework/orm/src/models/Error.ts
Original file line number Diff line number Diff line change
Expand Up @@ -240,13 +240,13 @@ export class ErrorModel {
}

async first(): Promise<ErrorModel | undefined> {
return await this.first()
return await this.applyFirst()
}

static async first(): Promise<ErrorModel | undefined> {
const instance = new ErrorModel(null)

return await instance.first()
return await instance.applyFirst()
}

async firstOrFail(): Promise<ErrorModel | undefined> {
Expand Down
4 changes: 2 additions & 2 deletions storage/framework/orm/src/models/FailedJob.ts
Original file line number Diff line number Diff line change
Expand Up @@ -240,13 +240,13 @@ export class FailedJobModel {
}

async first(): Promise<FailedJobModel | undefined> {
return await this.first()
return await this.applyFirst()
}

static async first(): Promise<FailedJobModel | undefined> {
const instance = new FailedJobModel(null)

return await instance.first()
return await instance.applyFirst()
}

async firstOrFail(): Promise<FailedJobModel | undefined> {
Expand Down
4 changes: 2 additions & 2 deletions storage/framework/orm/src/models/Job.ts
Original file line number Diff line number Diff line change
Expand Up @@ -240,13 +240,13 @@ export class JobModel {
}

async first(): Promise<JobModel | undefined> {
return await this.first()
return await this.applyFirst()
}

static async first(): Promise<JobModel | undefined> {
const instance = new JobModel(null)

return await instance.first()
return await instance.applyFirst()
}

async firstOrFail(): Promise<JobModel | undefined> {
Expand Down
4 changes: 2 additions & 2 deletions storage/framework/orm/src/models/PaymentMethod.ts
Original file line number Diff line number Diff line change
Expand Up @@ -290,13 +290,13 @@ export class PaymentMethodModel {
}

async first(): Promise<PaymentMethodModel | undefined> {
return await this.first()
return await this.applyFirst()
}

static async first(): Promise<PaymentMethodModel | undefined> {
const instance = new PaymentMethodModel(null)

return await instance.first()
return await instance.applyFirst()
}

async firstOrFail(): Promise<PaymentMethodModel | undefined> {
Expand Down
4 changes: 2 additions & 2 deletions storage/framework/orm/src/models/Post.ts
Original file line number Diff line number Diff line change
Expand Up @@ -226,13 +226,13 @@ export class PostModel {
}

async first(): Promise<PostModel | undefined> {
return await this.first()
return await this.applyFirst()
}

static async first(): Promise<PostModel | undefined> {
const instance = new PostModel(null)

return await instance.first()
return await instance.applyFirst()
}

async firstOrFail(): Promise<PostModel | undefined> {
Expand Down
4 changes: 2 additions & 2 deletions storage/framework/orm/src/models/Product.ts
Original file line number Diff line number Diff line change
Expand Up @@ -268,13 +268,13 @@ export class ProductModel {
}

async first(): Promise<ProductModel | undefined> {
return await this.first()
return await this.applyFirst()
}

static async first(): Promise<ProductModel | undefined> {
const instance = new ProductModel(null)

return await instance.first()
return await instance.applyFirst()
}

async firstOrFail(): Promise<ProductModel | undefined> {
Expand Down
4 changes: 2 additions & 2 deletions storage/framework/orm/src/models/Project.ts
Original file line number Diff line number Diff line change
Expand Up @@ -231,13 +231,13 @@ export class ProjectModel {
}

async first(): Promise<ProjectModel | undefined> {
return await this.first()
return await this.applyFirst()
}

static async first(): Promise<ProjectModel | undefined> {
const instance = new ProjectModel(null)

return await instance.first()
return await instance.applyFirst()
}

async firstOrFail(): Promise<ProjectModel | undefined> {
Expand Down
4 changes: 2 additions & 2 deletions storage/framework/orm/src/models/Release.ts
Original file line number Diff line number Diff line change
Expand Up @@ -204,13 +204,13 @@ export class ReleaseModel {
}

async first(): Promise<ReleaseModel | undefined> {
return await this.first()
return await this.applyFirst()
}

static async first(): Promise<ReleaseModel | undefined> {
const instance = new ReleaseModel(null)

return await instance.first()
return await instance.applyFirst()
}

async firstOrFail(): Promise<ReleaseModel | undefined> {
Expand Down
4 changes: 2 additions & 2 deletions storage/framework/orm/src/models/Subscriber.ts
Original file line number Diff line number Diff line change
Expand Up @@ -204,13 +204,13 @@ export class SubscriberModel {
}

async first(): Promise<SubscriberModel | undefined> {
return await this.first()
return await this.applyFirst()
}

static async first(): Promise<SubscriberModel | undefined> {
const instance = new SubscriberModel(null)

return await instance.first()
return await instance.applyFirst()
}

async firstOrFail(): Promise<SubscriberModel | undefined> {
Expand Down
4 changes: 2 additions & 2 deletions storage/framework/orm/src/models/SubscriberEmail.ts
Original file line number Diff line number Diff line change
Expand Up @@ -214,13 +214,13 @@ export class SubscriberEmailModel {
}

async first(): Promise<SubscriberEmailModel | undefined> {
return await this.first()
return await this.applyFirst()
}

static async first(): Promise<SubscriberEmailModel | undefined> {
const instance = new SubscriberEmailModel(null)

return await instance.first()
return await instance.applyFirst()
}

async firstOrFail(): Promise<SubscriberEmailModel | undefined> {
Expand Down
4 changes: 2 additions & 2 deletions storage/framework/orm/src/models/Subscription.ts
Original file line number Diff line number Diff line change
Expand Up @@ -308,13 +308,13 @@ export class SubscriptionModel {
}

async first(): Promise<SubscriptionModel | undefined> {
return await this.first()
return await this.applyFirst()
}

static async first(): Promise<SubscriptionModel | undefined> {
const instance = new SubscriptionModel(null)

return await instance.first()
return await instance.applyFirst()
}

async firstOrFail(): Promise<SubscriptionModel | undefined> {
Expand Down
4 changes: 2 additions & 2 deletions storage/framework/orm/src/models/Team.ts
Original file line number Diff line number Diff line change
Expand Up @@ -277,13 +277,13 @@ export class TeamModel {
}

async first(): Promise<TeamModel | undefined> {
return await this.first()
return await this.applyFirst()
}

static async first(): Promise<TeamModel | undefined> {
const instance = new TeamModel(null)

return await instance.first()
return await instance.applyFirst()
}

async firstOrFail(): Promise<TeamModel | undefined> {
Expand Down
6 changes: 3 additions & 3 deletions storage/framework/orm/src/models/Transaction.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ interface QueryOptions {

export class TransactionModel {
private readonly hidden: Array<keyof TransactionJsonResponse> = []
private readonly fillable: Array<keyof TransactionJsonResponse> = ['name', 'description', 'amount', 'type', 'provider_id', 'uuid', 'payment_method_id', 'user_id']
private readonly fillable: Array<keyof TransactionJsonResponse> = ['name', 'description', 'amount', 'type', 'provider_id', 'uuid', 'user_id', 'payment_method_id']
private readonly guarded: Array<keyof TransactionJsonResponse> = []
protected attributes: Partial<TransactionType> = {}
protected originalAttributes: Partial<TransactionType> = {}
Expand Down Expand Up @@ -277,13 +277,13 @@ export class TransactionModel {
}

async first(): Promise<TransactionModel | undefined> {
return await this.first()
return await this.applyFirst()
}

static async first(): Promise<TransactionModel | undefined> {
const instance = new TransactionModel(null)

return await instance.first()
return await instance.applyFirst()
}

async firstOrFail(): Promise<TransactionModel | undefined> {
Expand Down
4 changes: 2 additions & 2 deletions storage/framework/orm/src/models/User.ts
Original file line number Diff line number Diff line change
Expand Up @@ -302,13 +302,13 @@ export class UserModel {
}

async first(): Promise<UserModel | undefined> {
return await this.first()
return await this.applyFirst()
}

static async first(): Promise<UserModel | undefined> {
const instance = new UserModel(null)

return await instance.first()
return await instance.applyFirst()
}

async firstOrFail(): Promise<UserModel | undefined> {
Expand Down
16 changes: 8 additions & 8 deletions storage/framework/orm/src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,24 +48,24 @@ export interface PasskeysTable {
}

export interface Database {
activities: ActivitiesTable
projects: ProjectsTable
failed_jobs: FailedJobsTable
subscriber_emails: SubscriberEmailsTable
products: ProductsTable
personal_access_tokens: PersonalAccessTokensTable
payment_methods: PaymentMethodsTable
team_users: TeamUsersTable
teams: TeamsTable
activities: ActivitiesTable
subscribers: SubscribersTable
transactions: TransactionsTable
jobs: JobsTable
subscriptions: SubscriptionsTable
deployments: DeploymentsTable
errors: ErrorsTable
releases: ReleasesTable
users: UsersTable
posts: PostsTable
failed_jobs: FailedJobsTable
products: ProductsTable
payment_methods: PaymentMethodsTable
transactions: TransactionsTable
jobs: JobsTable
subscriptions: SubscriptionsTable
errors: ErrorsTable
passkeys: PasskeysTable
migrations: MigrationsTable
}
4 changes: 2 additions & 2 deletions storage/framework/requests/TransactionRequest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ interface RequestDataTransaction {
amount: number
type: string
provider_id: string
payment_method_id: number
user_id: number
payment_method_id: number
created_at?: Date
updated_at?: Date
}
Expand All @@ -29,8 +29,8 @@ export class TransactionRequest extends Request<RequestDataTransaction> implemen
public amount = 0
public type = ''
public provider_id = ''
public payment_method_id = 0
public user_id = 0
public payment_method_id = 0
public created_at = new Date()
public updated_at = new Date()
public uuid = ''
Expand Down
Loading

0 comments on commit 8323fbd

Please sign in to comment.