Skip to content

Commit

Permalink
added user rc config model
Browse files Browse the repository at this point in the history
  • Loading branch information
michaeldisaro committed Feb 7, 2024
1 parent 1cb4f44 commit 53e7256
Showing 1 changed file with 44 additions and 0 deletions.
44 changes: 44 additions & 0 deletions src/models/user_rc_configuration.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
import * as t from "io-ts";
import { NonEmptyString } from "@pagopa/ts-commons/lib/strings";
import { Container } from "@azure/cosmos";
import { CosmosResource, CosmosdbModel } from "../utils/cosmosdb_model";

export const USER_RC_CONFIGURATIONS_COLLECTION_NAME = "user-configurations";
const USER_RC_CONFIGURATIONS_MODEL_PK_FIELD = "userId";

const UserRCConfiguration = t.interface({
userId: NonEmptyString,
id: NonEmptyString
});
export type UserRCConfiguration = t.TypeOf<typeof UserRCConfiguration>;

export const RetrievedUserRCConfiguration = t.intersection([
UserRCConfiguration,
CosmosResource
]);
export type RetrievedUserRCConfiguration = t.TypeOf<
typeof RetrievedUserRCConfiguration
>;

/**
* @deprecated This model is deprecated, use the one inside ./remote_content.ts instead
*/
export class UserRCConfigurationModel extends CosmosdbModel<
UserRCConfiguration,
UserRCConfiguration,
RetrievedUserRCConfiguration,
typeof USER_RC_CONFIGURATIONS_MODEL_PK_FIELD
> {
/**
* Creates a new RemoteContentConfiguration model
*
* @param container the Cosmos container client
*/
constructor(container: Container) {
super(
container,
UserRCConfiguration,
RetrievedUserRCConfiguration
);
}
}

0 comments on commit 53e7256

Please sign in to comment.