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

CreateAt Doesn't Auto-Generate for Android, but Works for iOS #2621

Closed
1 task done
khatruong2009 opened this issue Nov 3, 2023 · 4 comments
Closed
1 task done

CreateAt Doesn't Auto-Generate for Android, but Works for iOS #2621

khatruong2009 opened this issue Nov 3, 2023 · 4 comments
Labels
bug Something isn't working closing soon This issue will be closed in 7 days unless further comments are made. datastore DataStore category/plugins not-reproducible Not able to reproduce the issue pending-community-response Issue is pending response from the issue requestor

Comments

@khatruong2009
Copy link
Member

Before opening, please confirm:

Language and Async Model

Kotlin

Amplify Categories

DataStore

Gradle script dependencies

// Put output below this line

Environment information

# Put output below this line


Please include any relevant guides or documentation you're referencing

No response

Describe the bug

createdAt and updatedAt fields are not automatically being generated when saving records on android but is being generated when saved on iOS. Here is the original issue.
image

Reproduction steps (if applicable)

  1. Add datastore with the attached schema.
  2. Save a record with the attached sample code on iOS and then on Android.
  3. Go to DynamoDB/AppSync and see that only iOS records have the auto generated createdAt and updatedAt fields.

Code Snippet

// Put your code below this line.
 Future<void> addBankroll(
    String icon,
    String name,
    String description,
    DateTime createdOn,
   // createdAt and updatedAt is null here
   // When I sync with iphone they are auto-generated
   // but with android they are null

  ) async {
    Bankroll bankroll = Bankroll(
      icon: icon,
      name: name,
      description: description,
      createdOn: TemporalDateTime(createdOn),
      orderIndex: null,
      isVisible: true,
    );
    state = const AsyncValue.loading();
    state = await AsyncValue.guard(
      () async {
        final bankrollRepository = ref.watch(bankrollRepositoryProvider);
        await bankrollRepository.addBankroll(bankroll);
        return _getBankrollList();
      },
    );
  }

Log output

// Put your logs below this line


amplifyconfiguration.json

No response

GraphQL Schema

// Put your schema below this line
type Bankroll @model @auth(rules: [{allow: owner}]) {
  id: ID!
  createdAt: AWSDateTime
  updatedAt: AWSDateTime
  name: String
  icon: String
  currency: String
  description: String
  GameSessions: [GameSession] @hasMany(indexName: "byBankroll", fields: ["id"])
  LiveGameSessions: [LiveGameSession] @hasMany(indexName: "byBankroll", fields: ["id"])
  createdOn: AWSDateTime
  updatedOn: AWSDateTime
  orderIndex: Int
  isVisible: Boolean
}

type GameSession @model @auth(rules: [{allow: owner}]) {
  id: ID!
  createdAt: AWSDateTime
  updatedAt: AWSDateTime
  gameType: GameType!
  limitType: LimitType!
  buyIn: Float
  cashout: Float
  tableSize: Int
  smallBlind: Float
  bigBlind: Float
  ante: Float
  rank: Int
  currency: String
  startDate: AWSDateTime
  endDate: AWSDateTime
  duration: Int
  note: String
  location: String
  bankrollID: ID! @index(name: "byBankroll")
  bankroll: Bankroll @belongsTo(fields: ["bankrollID"])
  createdOn: AWSDateTime
  updatedOn: AWSDateTime
}

type LiveGameSession @model @auth(rules: [{allow: owner}]) {
  id: ID!
  createdAt: AWSDateTime
  updatedAt: AWSDateTime
  gameType: GameType!
  limitType: LimitType!
  buyIn: Float
  cashout: Float
  tableSize: Int
  smallBlind: Float
  bigBlind: Float
  ante: Float
  rank: Int
  currency: String
  startDate: AWSDateTime
  endDate: AWSDateTime
  duration: Int
  note: String
  location: String
  bankrollID: ID! @index(name: "byBankroll")
  bankroll: Bankroll @belongsTo(fields: ["bankrollID"])
  createdOn: AWSDateTime
  updatedOn: AWSDateTime
}

enum GameType {
  cashGame
  onlineGame
  tournament
  pubTournament
  casualGame
}

enum LimitType {
  noLimit
  potLimit
  fixedLimit
  mixedLimit
}

Additional information and screenshots

No response

@ankpshah ankpshah assigned ankpshah and unassigned ankpshah Nov 3, 2023
@ankpshah ankpshah added the pending-triage Issue is pending triage label Nov 3, 2023
@tylerjroach tylerjroach added the bug Something isn't working label Nov 14, 2023
@tylerjroach
Copy link
Member

Thanks for the report. We will take a look.

@tjleing tjleing added the datastore DataStore category/plugins label Nov 20, 2023
@ankpshah
Copy link
Contributor

ankpshah commented Dec 5, 2023

Hi,
The GraphqQL schema, does not need to have createdAt and updatedAt fields. This fields are automatically generated and populated with relevant values. I tried removing those fields from graphQL Schema and it works as expected. Let me know if the issue still persists.

@ankpshah ankpshah added not-reproducible Not able to reproduce the issue pending-community-response Issue is pending response from the issue requestor closing soon This issue will be closed in 7 days unless further comments are made. and removed pending-triage Issue is pending triage labels Dec 5, 2023
@mattcreaser
Copy link
Member

Hi I'm closing this issue due to inactivity - if you still need assistance please feel free to open another issue. Thanks!

Copy link
Contributor

⚠️COMMENT VISIBILITY WARNING⚠️

Comments on closed issues are hard for our team to see.
If you need more assistance, please either tag a team member or open a new issue that references this one.
If you wish to keep having a conversation with other community members under this issue feel free to do so.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working closing soon This issue will be closed in 7 days unless further comments are made. datastore DataStore category/plugins not-reproducible Not able to reproduce the issue pending-community-response Issue is pending response from the issue requestor
Projects
None yet
Development

No branches or pull requests

5 participants