(orm: AbstractQuery<typeof v1>)
| 29 | }, |
| 30 | }); |
| 31 | async function run(orm: AbstractQuery<typeof v1>): Promise<string> { |
| 32 | const lines: string[] = []; |
| 33 | |
| 34 | lines.push("create one"); |
| 35 | lines.push( |
| 36 | inspect( |
| 37 | await orm.create("users", { |
| 38 | id: "generated-cuid", |
| 39 | name: "fuma", |
| 40 | }), |
| 41 | { depth: null, sorted: true }, |
| 42 | ), |
| 43 | ); |
| 44 | lines.push("create other users"); |
| 45 | lines.push( |
| 46 | inspect( |
| 47 | await orm.createMany("users", [ |
| 48 | { |
| 49 | id: "alfon", |
| 50 | name: "alfon", |
| 51 | }, |
| 52 | { |
| 53 | id: "test", |
| 54 | name: "Test User", |
| 55 | }, |
| 56 | ]), |
| 57 | { depth: null, sorted: true }, |
| 58 | ), |
| 59 | ); |
| 60 | |
| 61 | lines.push("initial data ready"); |
| 62 | await orm.createMany("messages", [ |
| 63 | { |
| 64 | user: "alfon", |
| 65 | content: "Hello World 1 by alfon", |
| 66 | id: "1", |
| 67 | }, |
| 68 | { |
| 69 | user: "alfon", |
| 70 | content: "Hello World 2 by alfon", |
| 71 | id: "2", |
| 72 | mentionId: "1", |
| 73 | }, |
| 74 | ]); |
| 75 | lines.push( |
| 76 | inspect(await orm.findMany("users", { orderBy: ["id", "asc"] }), { |
| 77 | depth: null, |
| 78 | sorted: true, |
| 79 | }), |
| 80 | inspect(await orm.findMany("messages", { orderBy: ["id", "asc"] }), { |
| 81 | depth: null, |
| 82 | sorted: true, |
| 83 | }), |
| 84 | ); |
| 85 | |
| 86 | lines.push("test joins: user -> messages -> mentioned by"); |
| 87 | lines.push( |
| 88 | inspect( |
no test coverage detected