Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix (crud): update idempotent methods to match argument's order #19

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

lolio-dev
Copy link

📚 Description

Changing the arguments order for the fetchOrCreateMany and updateOrCreateMany in the examples to reflect reality.

@lolio-dev
Copy link
Author

@RomainLanz poke

@RomainLanz
Copy link
Member

Hey @lolio-dev! 👋🏻

I am not sure you are right. Looking at the source code, the current signature is correct.

/**
 * Find existing rows or create missing one's. One database call per insert
 * is invoked, so that each insert goes through the lifecycle of model
 * hooks.
 */
static fetchOrCreateMany(uniqueKeys: any, payload: any, options?: ModelAssignOptions): Promise<any[]>;

/**
 * Update existing rows or create missing one's. One database call per insert
 * is invoked, so that each insert and update goes through the lifecycle
 * of model hooks.
 */
static updateOrCreateMany(uniqueKeys: any, payload: any, options?: ModelAssignOptions): Promise<any>;

@lolio-dev
Copy link
Author

Hi @RomainLanz, when I look in the source code in local, I don't have at all the same code as you but I have this:

    fetchOrCreateMany(payload: Partial<ModelAttributes<InstanceType<RelatedModel>>>[], predicate?: keyof ModelAttributes<InstanceType<RelatedModel>> | (keyof ModelAttributes<InstanceType<RelatedModel>>)[], options?: ModelAssignOptions): Promise<InstanceType<RelatedModel>[]>;
    /**
     * Update or create rows. Providers a great API to sync rows
     */
    updateOrCreateMany(payload: Partial<ModelAttributes<InstanceType<RelatedModel>>>[], predicate?: keyof ModelAttributes<InstanceType<RelatedModel>> | (keyof ModelAttributes<InstanceType<RelatedModel>>)[], options?: ModelAssignOptions): Promise<InstanceType<RelatedModel>[]>;

I am with the last version of lucid (20.5.1)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants